mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: avoid gobwas/ws pbytes.GetLen panic
This commit is contained in:
parent
ed210ee403
commit
f572e7fba8
|
@ -65,6 +65,11 @@ type WebsocketConfig struct {
|
|||
// Read implements net.Conn.Read()
|
||||
// modify from gobwas/ws/wsutil.readData
|
||||
func (wsc *websocketConn) Read(b []byte) (n int, err error) {
|
||||
defer func() { // avoid gobwas/ws pbytes.GetLen panic
|
||||
if value := recover(); value != nil {
|
||||
err = fmt.Errorf("websocket error: %s", value)
|
||||
}
|
||||
}()
|
||||
var header ws.Header
|
||||
for {
|
||||
n, err = wsc.reader.Read(b)
|
||||
|
|
Loading…
Reference in New Issue
Block a user