mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
Fix race condition in UDT, check if socket is nil before closing it
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user