mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 08:01:31 +00:00
tsnet: return from Accept when the listener gets closed
Fixes #14808 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:

committed by
Anton Tolchanov

parent
6f10fe8ab1
commit
3abfbf50ae
@@ -1286,11 +1286,12 @@ type listener struct {
|
||||
}
|
||||
|
||||
func (ln *listener) Accept() (net.Conn, error) {
|
||||
c, ok := <-ln.conn
|
||||
if !ok {
|
||||
select {
|
||||
case c := <-ln.conn:
|
||||
return c, nil
|
||||
case <-ln.closedc:
|
||||
return nil, fmt.Errorf("tsnet: %w", net.ErrClosed)
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (ln *listener) Addr() net.Addr { return addr{ln} }
|
||||
|
Reference in New Issue
Block a user