@@ -1213,32 +1213,17 @@ func (c *Conn) receiveIPv6() conn.ReceiveFunc {
1213
1213
return c .mkReceiveFunc (& c .pconn6 , & health .ReceiveIPv6 , metricRecvDataIPv6 )
1214
1214
}
1215
1215
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
-
1225
1216
// mkReceiveFunc creates a ReceiveFunc reading from ruc.
1226
1217
// The provided healthItem and metric are updated if non-nil.
1227
1218
func (c * Conn ) mkReceiveFunc (ruc * RebindingUDPConn , healthItem * health.ReceiveFuncStats , metric * clientmetric.Metric ) conn.ReceiveFunc {
1228
1219
// epCache caches an IPPort->endpoint for hot flows.
1229
1220
var epCache ippEndpointCache
1230
- var connErr error
1231
1221
1232
1222
return func (buffs [][]byte , sizes []int , eps []conn.Endpoint ) (int , error ) {
1233
1223
if healthItem != nil {
1234
1224
healthItem .Enter ()
1235
1225
defer healthItem .Exit ()
1236
1226
}
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
- }
1242
1227
if ruc == nil {
1243
1228
panic ("nil RebindingUDPConn" )
1244
1229
}
@@ -1252,12 +1237,9 @@ func (c *Conn) mkReceiveFunc(ruc *RebindingUDPConn, healthItem *health.ReceiveFu
1252
1237
continue
1253
1238
}
1254
1239
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 }
1258
1240
c .logf ("magicsock: receive: rebind required due to socket reset: %v" , err )
1259
1241
c .Rebind ()
1260
- return 0 , connErr
1242
+ c . ReSTUN ( "socket-reset" )
1261
1243
}
1262
1244
1263
1245
return 0 , err
0 commit comments