diff --git a/src/tuntap/conn.go b/src/tuntap/conn.go index 1d47b37..0bb4efd 100644 --- a/src/tuntap/conn.go +++ b/src/tuntap/conn.go @@ -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() } } diff --git a/src/tuntap/iface.go b/src/tuntap/iface.go index a95dfae..1cee9b4 100644 --- a/src/tuntap/iface.go +++ b/src/tuntap/iface.go @@ -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 } } }