mirror of
				https://github.com/minio/minio.git
				synced 2025-10-30 00:05:02 -04:00 
			
		
		
		
	protect wg.Done from being called twice (#17075)
This commit is contained in:
		
							parent
							
								
									e7cac8acef
								
							
						
					
					
						commit
						c8b92f6067
					
				| @ -25,13 +25,16 @@ import ( | |||||||
| // PipeWriter is similar to io.PipeWriter with wait group | // PipeWriter is similar to io.PipeWriter with wait group | ||||||
| type PipeWriter struct { | type PipeWriter struct { | ||||||
| 	*io.PipeWriter | 	*io.PipeWriter | ||||||
|  | 	once sync.Once | ||||||
| 	done func() | 	done func() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // CloseWithError close with supplied error the writer end. | // CloseWithError close with supplied error the writer end. | ||||||
| func (w *PipeWriter) CloseWithError(err error) error { | func (w *PipeWriter) CloseWithError(err error) error { | ||||||
| 	err = w.PipeWriter.CloseWithError(err) | 	err = w.PipeWriter.CloseWithError(err) | ||||||
| 	w.done() | 	w.once.Do(func() { | ||||||
|  | 		w.done() | ||||||
|  | 	}) | ||||||
| 	return err | 	return err | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user