mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 08:21:36 +00:00
remove some lossy channel sends that should be safe to allow to block
This commit is contained in:
parent
6da5802ae5
commit
7bf5884ac1
@ -72,11 +72,7 @@ func (s *tunConn) reader() (err error) {
|
|||||||
}
|
}
|
||||||
} else if n > 0 {
|
} else if n > 0 {
|
||||||
bs := append(util.GetBytes(), b[:n]...)
|
bs := append(util.GetBytes(), b[:n]...)
|
||||||
select {
|
s.tun.send <- bs
|
||||||
case s.tun.send <- bs:
|
|
||||||
default:
|
|
||||||
util.PutBytes(bs)
|
|
||||||
}
|
|
||||||
s.stillAlive()
|
s.stillAlive()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,11 +260,8 @@ func (tun *TunAdapter) readerPacketHandler(ch chan []byte) {
|
|||||||
tun.mutex.Unlock()
|
tun.mutex.Unlock()
|
||||||
if tc != nil {
|
if tc != nil {
|
||||||
for _, packet := range packets {
|
for _, packet := range packets {
|
||||||
select {
|
p := packet // Possibly required because of how range
|
||||||
case tc.send <- packet:
|
tc.send <- p
|
||||||
default:
|
|
||||||
util.PutBytes(packet)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -274,11 +271,7 @@ func (tun *TunAdapter) readerPacketHandler(ch chan []byte) {
|
|||||||
}
|
}
|
||||||
// If we have a connection now, try writing to it
|
// If we have a connection now, try writing to it
|
||||||
if isIn && session != nil {
|
if isIn && session != nil {
|
||||||
select {
|
session.send <- bs
|
||||||
case session.send <- bs:
|
|
||||||
default:
|
|
||||||
util.PutBytes(bs)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user