We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fcbae9 commit 4b6e010Copy full SHA for 4b6e010
1 file changed
intra/netstack/fdbased.go
@@ -274,15 +274,15 @@ func (e *endpoint) Swap(fd int) (err error) {
274
}
275
276
prevfd := e.fds.Swap(f) // commence WritePackets() on fd
277
- core.Go(
278
- "ns.swap.wrapup", func() { e.inboundDispatcher.wrapup(prevfd, wrapttl) },
279
- ) // closes prevfd, which may be invalidfd
280
281
log.D("ns: tun: swap: fd %s => %d; err? %v", prevfd, fd, err)
282
283
if e.inboundDispatcher == nil { // prevfd must be 0 value if inbound is nil
+ prevfd.stop() // prevfd may be invalid
284
e.inboundDispatcher, err = createInboundDispatcher(e, f)
285
} else {
+ // closes prevfd, which may be invalidfd
+ core.Go("ns.swap.wrapup", func() { e.inboundDispatcher.wrapup(prevfd, wrapttl) })
286
e.inboundDispatcher.prepare(f)
287
288
0 commit comments