forked from quic-go/quic-go
fix race condition when closing the server after a Read failed
This commit is contained in:
@@ -141,7 +141,6 @@ func (h *packetHandlerMap) close(e error) error {
|
||||
h.mutex.Unlock()
|
||||
return nil
|
||||
}
|
||||
h.closed = true
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for _, handler := range h.handlers {
|
||||
@@ -153,8 +152,9 @@ func (h *packetHandlerMap) close(e error) error {
|
||||
}
|
||||
|
||||
if h.server != nil {
|
||||
h.server.closeWithError(e)
|
||||
h.server.setCloseError(e)
|
||||
}
|
||||
h.closed = true
|
||||
h.mutex.Unlock()
|
||||
wg.Wait()
|
||||
return getMultiplexer().RemoveConn(h.conn)
|
||||
|
||||
Reference in New Issue
Block a user