avoid calling close for nil inbound/outblock channels

This commit is contained in:
Harshavardhana 2024-01-28 19:56:15 -08:00
parent cff8235068
commit 9987ff570b
1 changed files with 10 additions and 4 deletions

View File

@ -325,9 +325,15 @@ func (m *muxServer) close() {
m.cancel() m.cancel()
m.recvMu.Lock() m.recvMu.Lock()
defer m.recvMu.Unlock() defer m.recvMu.Unlock()
xioutil.SafeClose(m.inbound)
m.inbound = nil
xioutil.SafeClose(m.outBlock) if m.inbound != nil {
m.outBlock = nil xioutil.SafeClose(m.inbound)
m.inbound = nil
}
if m.outBlock != nil {
xioutil.SafeClose(m.outBlock)
m.outBlock = nil
}
} }