From 9df96ac7f1a4332a2e9e7dfa6ccdcb9025b3a14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 11 Apr 2023 10:35:44 +0800 Subject: [PATCH] Fix deadline usage on websocket conn --- transport/v2raywebsocket/conn.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/transport/v2raywebsocket/conn.go b/transport/v2raywebsocket/conn.go index e050e2f2..e7571c84 100644 --- a/transport/v2raywebsocket/conn.go +++ b/transport/v2raywebsocket/conn.go @@ -69,6 +69,14 @@ func (c *WebsocketConn) SetDeadline(t time.Time) error { return os.ErrInvalid } +func (c *WebsocketConn) SetReadDeadline(t time.Time) error { + return os.ErrInvalid +} + +func (c *WebsocketConn) SetWriteDeadline(t time.Time) error { + return os.ErrInvalid +} + func (c *WebsocketConn) Upstream() any { return c.Conn.NetConn() } @@ -195,24 +203,15 @@ func (c *EarlyWebsocketConn) RemoteAddr() net.Addr { } func (c *EarlyWebsocketConn) SetDeadline(t time.Time) error { - if c.conn == nil { - return os.ErrInvalid - } - return c.conn.SetDeadline(t) + return os.ErrInvalid } func (c *EarlyWebsocketConn) SetReadDeadline(t time.Time) error { - if c.conn == nil { - return os.ErrInvalid - } - return c.conn.SetReadDeadline(t) + return os.ErrInvalid } func (c *EarlyWebsocketConn) SetWriteDeadline(t time.Time) error { - if c.conn == nil { - return os.ErrInvalid - } - return c.conn.SetWriteDeadline(t) + return os.ErrInvalid } func (c *EarlyWebsocketConn) Upstream() any {