From 8e2eb0b87bd9846b90664809bc2968a051088fb2 Mon Sep 17 00:00:00 2001 From: binhu Date: Thu, 23 Oct 2025 19:11:34 +0800 Subject: [PATCH] fix: writeControl close-frame fail caused by writeCtx canceled --- netconn.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netconn.go b/netconn.go index 1f73b04b..883d433d 100644 --- a/netconn.go +++ b/netconn.go @@ -114,12 +114,13 @@ type netConn struct { var _ net.Conn = &netConn{} -func (nc *netConn) Close() error { +func (nc *netConn) Close() (err error) { + err = nc.c.Close(StatusNormalClosure, "") nc.writeTimer.Stop() nc.writeCancel() nc.readTimer.Stop() nc.readCancel() - return nc.c.Close(StatusNormalClosure, "") + return err } func (nc *netConn) Write(p []byte) (int, error) {