net/memnet: allow listener address reuse (#17342)

Listen address reuse is allowed as soon as the previous listener is
closed. There is no attempt made to emulate more complex address reuse
logic.

Updates tailscale/corp#28078

Change-Id: I56be1c4848e7b3f9fc97fd4ef13a2de9dcfab0f2

Signed-off-by: Brian Palmer <brianp@tailscale.com>
This commit is contained in:
Brian Palmer
2025-09-29 16:30:23 -06:00
committed by GitHub
parent bdb69d1b1f
commit 54e50230a1
3 changed files with 34 additions and 0 deletions
+5
View File
@@ -61,6 +61,11 @@ func (m *Network) Listen(network, address string) (net.Listener, error) {
}
ln := Listen(key)
m.lns[key] = ln
ln.onClose = func() {
m.mu.Lock()
delete(m.lns, key)
m.mu.Unlock()
}
return ln, nil
}
}