mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2024-12-27 08:08:46 +01:00
device: handle broader range of errors in RoutineReceiveIncoming
RoutineReceiveIncoming exits immediately on net.ErrClosed, but not on other errors. However, for errors that are known to be permanent, such as syscall.EAFNOSUPPORT, we may as well exit immediately instead of retrying. This considerably speeds up the package device tests right now, because the Bind sometimes (incorrectly) returns syscall.EAFNOSUPPORT instead of net.ErrClosed. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
517f0703f5
commit
6228659a91
@ -104,6 +104,9 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind conn.Bind) {
|
|||||||
if errors.Is(err, net.ErrClosed) {
|
if errors.Is(err, net.ErrClosed) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if neterr, ok := err.(net.Error); ok && !neterr.Temporary() {
|
||||||
|
return
|
||||||
|
}
|
||||||
device.log.Errorf("Failed to receive packet: %v", err)
|
device.log.Errorf("Failed to receive packet: %v", err)
|
||||||
if deathSpiral < 10 {
|
if deathSpiral < 10 {
|
||||||
deathSpiral++
|
deathSpiral++
|
||||||
|
Loading…
Reference in New Issue
Block a user