lib/protocol: Don't block on Close (fixes #5794) (#5795)

This commit is contained in:
Simon Frei
2019-06-14 19:04:41 +02:00
committed by Jakob Borg
parent 6b1d7ac727
commit 02752af862
3 changed files with 28 additions and 1 deletions

View File

@@ -882,7 +882,11 @@ func (c *rawConnection) Close(err error) {
}
})
c.internalClose(err)
// Close might be called from a method that is called from within
// dispatcherLoop, resulting in a deadlock.
// The sending above must happen before spawning the routine, to prevent
// the underlying connection from terminating before sending the close msg.
go c.internalClose(err)
}
// internalClose is called if there is an unexpected error during normal operation.