mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	pkg/broadcastwriter: reset after 4 KB w/o stream
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
This commit is contained in:
		
							parent
							
								
									d15d1674c3
								
							
						
					
					
						commit
						153f98bad5
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -42,9 +42,12 @@ func (w *BroadcastWriter) Write(p []byte) (n int, err error) {
 | 
			
		|||
				delete(writers, sw)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// exit if there is no more writers
 | 
			
		||||
		if len(w.streams) == 1 {
 | 
			
		||||
			w.buf.Reset()
 | 
			
		||||
			if w.buf.Len() >= 4096 {
 | 
			
		||||
				w.buf.Reset()
 | 
			
		||||
			} else {
 | 
			
		||||
				w.buf.Write(p)
 | 
			
		||||
			}
 | 
			
		||||
			w.Unlock()
 | 
			
		||||
			return len(p), nil
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue