Fix v2ray ws crash

This commit is contained in:
世界 2023-11-13 13:27:59 +08:00
parent 3ef9b1b343
commit f7c2eb6e76
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -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)