drop connections that come in between a close and an accept race
this is bad, but worse is the current logic which can sometimes hit a nil counter channel.
This commit is contained in:
parent
249c1519e3
commit
8f7f9df910
7
grace.go
7
grace.go
@ -135,12 +135,17 @@ func (l *listener) Accept() (net.Conn, error) {
|
|||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
l.counter <- inc
|
select {
|
||||||
|
case <-l.allClosed:
|
||||||
|
c.Close()
|
||||||
|
return nil, ErrAlreadyClosed
|
||||||
|
case l.counter <- inc:
|
||||||
return conn{
|
return conn{
|
||||||
Conn: c,
|
Conn: c,
|
||||||
counter: l.counter,
|
counter: l.counter,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
panic("not reached")
|
panic("not reached")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user