mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-01 02:49:41 +00:00
Fix v2ray ws crash
This commit is contained in:
parent
3ef9b1b343
commit
f7c2eb6e76
|
@ -153,6 +153,9 @@ func (c *EarlyWebsocketConn) Write(b []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
c.access.Lock()
|
c.access.Lock()
|
||||||
defer c.access.Unlock()
|
defer c.access.Unlock()
|
||||||
|
if c.err != nil {
|
||||||
|
return 0, c.err
|
||||||
|
}
|
||||||
if c.conn != nil {
|
if c.conn != nil {
|
||||||
return c.conn.Write(b)
|
return c.conn.Write(b)
|
||||||
}
|
}
|
||||||
|
@ -174,6 +177,9 @@ func (c *EarlyWebsocketConn) WriteBuffer(buffer *buf.Buffer) error {
|
||||||
if c.conn != nil {
|
if c.conn != nil {
|
||||||
return c.conn.WriteBuffer(buffer)
|
return c.conn.WriteBuffer(buffer)
|
||||||
}
|
}
|
||||||
|
if c.err != nil {
|
||||||
|
return c.err
|
||||||
|
}
|
||||||
err := c.writeRequest(buffer.Bytes())
|
err := c.writeRequest(buffer.Bytes())
|
||||||
c.err = err
|
c.err = err
|
||||||
close(c.create)
|
close(c.create)
|
||||||
|
|
Loading…
Reference in a new issue