Fix race condition in UDT, check if socket is nil before closing it

This commit is contained in:
Kleissner
2021-12-11 21:43:06 +01:00
parent c12b68c35c
commit 9f2783349e

View File

@@ -49,7 +49,9 @@ func (m *multiplexer) goRead() {
select {
case buf = <-m.incomingData:
case <-m.terminationSignal:
m.socket.Close() // Pass the external termination signal down to the socket. This makes sure any pending reader on the socket (especially if blocking) returns with EOF.
if m.socket != nil {
m.socket.Close() // Pass the external termination signal down to the socket. This makes sure any pending reader on the socket (especially if blocking) returns with EOF.
}
return
}