From f977efb68e50585776e479df84c88f23f0f47775 Mon Sep 17 00:00:00 2001 From: suhang Date: Mon, 6 Nov 2023 16:04:54 +0800 Subject: [PATCH] Fixed possible coroutine leaks caused by closing the connection with SetDeadline --- sess.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sess.go b/sess.go index 35e7b804..c68987ff 100644 --- a/sess.go +++ b/sess.go @@ -380,7 +380,7 @@ func (s *UDPSession) SetDeadline(t time.Time) error { s.wd = t s.notifyReadEvent() s.notifyWriteEvent() - return nil + return s.conn.SetDeadline(t) } // SetReadDeadline implements the Conn SetReadDeadline method. @@ -389,7 +389,7 @@ func (s *UDPSession) SetReadDeadline(t time.Time) error { defer s.mu.Unlock() s.rd = t s.notifyReadEvent() - return nil + return s.conn.SetReadDeadline(t) } // SetWriteDeadline implements the Conn SetWriteDeadline method. @@ -398,7 +398,7 @@ func (s *UDPSession) SetWriteDeadline(t time.Time) error { defer s.mu.Unlock() s.wd = t s.notifyWriteEvent() - return nil + return s.conn.SetWriteDeadline(t) } // SetWriteDelay delays write for bulk transfer until the next update interval