mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Don't write huge mostly empty buffers unnecessarily
This commit is contained in:
		
							parent
							
								
									47eb2fc47f
								
							
						
					
					
						commit
						ccf03fd3b6
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -263,7 +263,7 @@ func (tun *TunAdapter) ifaceReader() error {
 | 
				
			||||||
		tun.mutex.Lock()
 | 
							tun.mutex.Lock()
 | 
				
			||||||
		if conn, isIn := tun.conns[*dstNodeID]; isIn {
 | 
							if conn, isIn := tun.conns[*dstNodeID]; isIn {
 | 
				
			||||||
			tun.mutex.Unlock()
 | 
								tun.mutex.Unlock()
 | 
				
			||||||
			w, err := conn.Write(bs)
 | 
								w, err := conn.Write(bs[:n])
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				tun.log.Errorln("TUN/TAP conn write error:", err)
 | 
									tun.log.Errorln("TUN/TAP conn write error:", err)
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue