Skip to content

Commit

Permalink
avoid calling close for nil inbound/outblock channels
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Jan 29, 2024
1 parent cff8235 commit 9987ff5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/grid/muxserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,15 @@ func (m *muxServer) close() {
m.cancel()
m.recvMu.Lock()
defer m.recvMu.Unlock()
xioutil.SafeClose(m.inbound)
m.inbound = nil

xioutil.SafeClose(m.outBlock)
m.outBlock = nil
if m.inbound != nil {
xioutil.SafeClose(m.inbound)
m.inbound = nil
}

if m.outBlock != nil {
xioutil.SafeClose(m.outBlock)
m.outBlock = nil

}
}

0 comments on commit 9987ff5

Please sign in to comment.