mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	remove some lossy channel sends that should be safe to allow to block
This commit is contained in:
		
							parent
							
								
									6da5802ae5
								
							
						
					
					
						commit
						7bf5884ac1
					
				
					 2 changed files with 4 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -72,11 +72,7 @@ func (s *tunConn) reader() (err error) {
 | 
			
		|||
			}
 | 
			
		||||
		} else if n > 0 {
 | 
			
		||||
			bs := append(util.GetBytes(), b[:n]...)
 | 
			
		||||
			select {
 | 
			
		||||
			case s.tun.send <- bs:
 | 
			
		||||
			default:
 | 
			
		||||
				util.PutBytes(bs)
 | 
			
		||||
			}
 | 
			
		||||
			s.tun.send <- bs
 | 
			
		||||
			s.stillAlive()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -260,11 +260,8 @@ func (tun *TunAdapter) readerPacketHandler(ch chan []byte) {
 | 
			
		|||
				tun.mutex.Unlock()
 | 
			
		||||
				if tc != nil {
 | 
			
		||||
					for _, packet := range packets {
 | 
			
		||||
						select {
 | 
			
		||||
						case tc.send <- packet:
 | 
			
		||||
						default:
 | 
			
		||||
							util.PutBytes(packet)
 | 
			
		||||
						}
 | 
			
		||||
						p := packet // Possibly required because of how range
 | 
			
		||||
						tc.send <- p
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}()
 | 
			
		||||
| 
						 | 
				
			
			@ -274,11 +271,7 @@ func (tun *TunAdapter) readerPacketHandler(ch chan []byte) {
 | 
			
		|||
		}
 | 
			
		||||
		// If we have a connection now, try writing to it
 | 
			
		||||
		if isIn && session != nil {
 | 
			
		||||
			select {
 | 
			
		||||
			case session.send <- bs:
 | 
			
		||||
			default:
 | 
			
		||||
				util.PutBytes(bs)
 | 
			
		||||
			}
 | 
			
		||||
			session.send <- bs
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue