From aba76787a56f5c6594b548dc950beefeef2f306c Mon Sep 17 00:00:00 2001 From: xtaci Date: Tue, 11 Jun 2019 15:27:26 +0800 Subject: [PATCH] bug fix --- sess.go | 5 +++-- tx_linux.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sess.go b/sess.go index ba049b1..8f163fb 100644 --- a/sess.go +++ b/sess.go @@ -104,8 +104,9 @@ type ( nonce Entropy // packets waiting to be sent on wire - txqueue []ipv4.Message - xconn batchConn // for x/net + txqueue []ipv4.Message + xconn batchConn // for x/net + xconnWriteError error mu sync.Mutex } diff --git a/tx_linux.go b/tx_linux.go index e609aac..b61d77c 100644 --- a/tx_linux.go +++ b/tx_linux.go @@ -13,7 +13,7 @@ import ( func (s *UDPSession) tx(txqueue []ipv4.Message) { // default version - if s.xconn == nil { + if s.xconn == nil || s.xconnWriteError != nil { s.defaultTx(txqueue) return } @@ -36,7 +36,7 @@ func (s *UDPSession) tx(txqueue []ipv4.Message) { if operr, ok := err.(*net.OpError); ok { if se, ok := operr.Err.(*os.SyscallError); ok { if se.Syscall == "sendmmsg" { - s.xconn = nil // set s.xconn to nil permanently + s.xconnWriteError = se s.defaultTx(txqueue) return }