mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 12:27:37 +03:00
Fix listener error
This commit is contained in:
parent
b1ce47aaca
commit
1adec71629
2 changed files with 5 additions and 4 deletions
|
@ -83,8 +83,9 @@ func (l *Listener) Close() error {
|
|||
|
||||
func (l *Listener) loop() {
|
||||
for {
|
||||
tcpConn, err := l.Accept()
|
||||
tcpConn, err := l.AcceptTCP()
|
||||
if err != nil {
|
||||
l.handler.HandleError(E.New("tcp listener closed: ", err))
|
||||
l.Close()
|
||||
return
|
||||
}
|
|
@ -99,7 +99,7 @@ func (l *Listener) loop() {
|
|||
for {
|
||||
n, addr, err := l.ReadFromUDPAddrPort(data)
|
||||
if err != nil {
|
||||
l.handler.HandleError(err)
|
||||
l.handler.HandleError(E.New("udp listener closed: ", err))
|
||||
return
|
||||
}
|
||||
buffer.Resize(buf.ReversedHeader, n)
|
||||
|
@ -118,13 +118,13 @@ func (l *Listener) loop() {
|
|||
for {
|
||||
n, oobN, _, addr, err := l.ReadMsgUDPAddrPort(data, oob)
|
||||
if err != nil {
|
||||
l.handler.HandleError(err)
|
||||
l.handler.HandleError(E.New("udp listener closed: ", err))
|
||||
return
|
||||
}
|
||||
destination, err := redir.GetOriginalDestinationFromOOB(oob[:oobN])
|
||||
if err != nil {
|
||||
l.handler.HandleError(E.Cause(err, "get original destination"))
|
||||
return
|
||||
continue
|
||||
}
|
||||
buffer.Resize(buf.ReversedHeader, n)
|
||||
err = l.handler.NewPacket(l, buffer, M.Metadata{
|
Loading…
Add table
Add a link
Reference in a new issue