Don't shut down the conn if it isn't set (in the case of local peer)

This commit is contained in:
Neil Alexander 2022-09-29 12:51:07 +01:00
parent 20c54cefc0
commit e6e59c3fc3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -154,7 +154,9 @@ func (p *peer) stop(err error) {
// Next we'll send a message to the state inbox in order to clean up.
p.router.state.Act(nil, func() {
// Make sure that the connection is closed.
_ = p.conn.Close()
if p.conn != nil {
_ = p.conn.Close()
}
// Drop all of the frames that are sitting in this peer's queues, since there
// is no way to send them at this point.