mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-05-25 11:28:03 +08:00
fix: listener close panic
This commit is contained in:
parent
199fb8fd5d
commit
5a21bf3642
@ -34,8 +34,8 @@ func (l *handleContextListener) init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if c, err := l.handle(l.ctx, c); err == nil {
|
if conn, err := l.handle(l.ctx, c); err == nil {
|
||||||
l.conns <- c
|
l.conns <- conn
|
||||||
} else {
|
} else {
|
||||||
// handle failed, close the underlying connection.
|
// handle failed, close the underlying connection.
|
||||||
_ = c.Close()
|
_ = c.Close()
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
N "github.com/metacubex/mihomo/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
@ -63,6 +64,7 @@ func NewListenerForHttps(l net.Listener, httpServer *http.Server, tlsConfig *Con
|
|||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}, func(a any) {
|
}, func(a any) {
|
||||||
log.Errorln("https server panic: %s", a)
|
stack := debug.Stack()
|
||||||
|
log.Errorln("https server panic: %s\n%s", a, stack)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
N "github.com/metacubex/mihomo/common/net"
|
N "github.com/metacubex/mihomo/common/net"
|
||||||
@ -89,7 +90,8 @@ func (b Builder) NewListener(l net.Listener) net.Listener {
|
|||||||
// We fixed it by calling Close() directly.
|
// We fixed it by calling Close() directly.
|
||||||
return realityConnWrapper{c}, nil
|
return realityConnWrapper{c}, nil
|
||||||
}, func(a any) {
|
}, func(a any) {
|
||||||
log.Errorln("reality server panic: %s", a)
|
stack := debug.Stack()
|
||||||
|
log.Errorln("reality server panic: %s\n%s", a, stack)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user