From f7c2eb6e7646bf4741f98d995a428843baf78291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 13 Nov 2023 13:27:59 +0800 Subject: [PATCH] Fix v2ray ws crash --- transport/v2raywebsocket/conn.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/transport/v2raywebsocket/conn.go b/transport/v2raywebsocket/conn.go index 1faeaa36..6400b118 100644 --- a/transport/v2raywebsocket/conn.go +++ b/transport/v2raywebsocket/conn.go @@ -153,6 +153,9 @@ func (c *EarlyWebsocketConn) Write(b []byte) (n int, err error) { } c.access.Lock() defer c.access.Unlock() + if c.err != nil { + return 0, c.err + } if c.conn != nil { return c.conn.Write(b) } @@ -174,6 +177,9 @@ func (c *EarlyWebsocketConn) WriteBuffer(buffer *buf.Buffer) error { if c.conn != nil { return c.conn.WriteBuffer(buffer) } + if c.err != nil { + return c.err + } err := c.writeRequest(buffer.Bytes()) c.err = err close(c.create)