Skip to content
This repository was archived by the owner on Jun 12, 2022. It is now read-only.

Commit 8af7e1c

Browse files
committed
🪛 Mitigate infinite loop in UDP NAT
1 parent d1ea6cf commit 8af7e1c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

service/nat.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package service
22

33
import (
44
"crypto/cipher"
5+
"errors"
56
"math/rand"
67
"net"
78
"sync"
@@ -106,6 +107,9 @@ func (c *natconn) timedCopy(ses *session, sm metrics.ShadowsocksMetrics) {
106107
return nil
107108
}
108109
}
110+
if errors.Is(err, net.ErrClosed) { //FIXME: locate the bug and remove this mitigation.
111+
expired = true
112+
}
109113
return onet.NewConnectionError("ERR_READ", "Failed to read from target", err)
110114
}
111115

0 commit comments

Comments
 (0)