mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #6987 from avagin:unix-close-accepted-queue
PiperOrigin-RevId: 418042597
This commit is contained in:
@@ -209,6 +209,7 @@ func (e *connectionedEndpoint) Listening() bool {
|
||||
// That is, close may be used to "unbind" or "disconnect" the socket in error
|
||||
// paths.
|
||||
func (e *connectionedEndpoint) Close(ctx context.Context) {
|
||||
var acceptedChan chan *connectionedEndpoint
|
||||
e.Lock()
|
||||
var c ConnectedEndpoint
|
||||
var r Receiver
|
||||
@@ -229,13 +230,16 @@ func (e *connectionedEndpoint) Close(ctx context.Context) {
|
||||
e.path = ""
|
||||
case e.Listening():
|
||||
close(e.acceptedChan)
|
||||
for n := range e.acceptedChan {
|
||||
n.Close(ctx)
|
||||
}
|
||||
acceptedChan = e.acceptedChan
|
||||
e.acceptedChan = nil
|
||||
e.path = ""
|
||||
}
|
||||
e.Unlock()
|
||||
if acceptedChan != nil {
|
||||
for n := range acceptedChan {
|
||||
n.Close(ctx)
|
||||
}
|
||||
}
|
||||
if c != nil {
|
||||
c.CloseNotify()
|
||||
c.Release(ctx)
|
||||
|
||||
Reference in New Issue
Block a user