Check before passive close

This commit is contained in:
Andy Wang 2019-10-15 22:06:23 +01:00
parent 3b3cd277f8
commit beb6568ce0
1 changed files with 4 additions and 2 deletions

View File

@ -61,8 +61,10 @@ func (sb *switchboard) removeConn(connId uint32) {
sb.connsM.Unlock()
if remaining == 0 {
atomic.StoreUint32(&sb.broken, 1)
sb.session.SetTerminalMsg("no underlying connection left")
sb.session.passiveClose()
if !sb.session.IsClosed() {
sb.session.SetTerminalMsg("no underlying connection left")
sb.session.passiveClose()
}
}
}