Skip to content

Commit fac0e1c

Browse files
committed
Comments
1 parent 9859a42 commit fac0e1c

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

wgengine/magicsock/magicsock.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,32 +1213,17 @@ func (c *Conn) receiveIPv6() conn.ReceiveFunc {
12131213
return c.mkReceiveFunc(&c.pconn6, &health.ReceiveIPv6, metricRecvDataIPv6)
12141214
}
12151215

1216-
type permanentNetError struct {
1217-
error
1218-
}
1219-
1220-
var _ net.Error = permanentNetError{}
1221-
1222-
func (permanentNetError) Timeout() bool { return false }
1223-
func (permanentNetError) Temporary() bool { return false }
1224-
12251216
// mkReceiveFunc creates a ReceiveFunc reading from ruc.
12261217
// The provided healthItem and metric are updated if non-nil.
12271218
func (c *Conn) mkReceiveFunc(ruc *RebindingUDPConn, healthItem *health.ReceiveFuncStats, metric *clientmetric.Metric) conn.ReceiveFunc {
12281219
// epCache caches an IPPort->endpoint for hot flows.
12291220
var epCache ippEndpointCache
1230-
var connErr error
12311221

12321222
return func(buffs [][]byte, sizes []int, eps []conn.Endpoint) (int, error) {
12331223
if healthItem != nil {
12341224
healthItem.Enter()
12351225
defer healthItem.Exit()
12361226
}
1237-
if connErr != nil {
1238-
// Just in case we get another call, we don't want to call ReadBatch
1239-
// again.
1240-
return 0, connErr
1241-
}
12421227
if ruc == nil {
12431228
panic("nil RebindingUDPConn")
12441229
}
@@ -1252,12 +1237,9 @@ func (c *Conn) mkReceiveFunc(ruc *RebindingUDPConn, healthItem *health.ReceiveFu
12521237
continue
12531238
}
12541239
if neterror.SocketWasReset(err) {
1255-
// Wrap the error in a permanentNetError so that Wireguard
1256-
// doesn't keep trying to read packets from us.
1257-
connErr = permanentNetError{error: err}
12581240
c.logf("magicsock: receive: rebind required due to socket reset: %v", err)
12591241
c.Rebind()
1260-
return 0, connErr
1242+
c.ReSTUN("socket-reset")
12611243
}
12621244

12631245
return 0, err

0 commit comments

Comments
 (0)