From 7bf5884ac1af2df80df503ccecd3fca629065218 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 4 Aug 2019 02:14:45 -0500 Subject: [PATCH] remove some lossy channel sends that should be safe to allow to block --- src/tuntap/conn.go | 6 +----- src/tuntap/iface.go | 13 +++---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/tuntap/conn.go b/src/tuntap/conn.go index 1d47b378..0bb4efdc 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 a95dfae4..1cee9b45 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 } } }