From d368ee160993a12259feb807c966196da706eae3 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 23 Oct 2018 20:49:00 -0700 Subject: [PATCH] safe shutdown --- peer/cwtch_peer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index e7c11e5..9a8ad47 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -444,7 +444,9 @@ func (cp *cwtchPeer) Listen() error { // Shutdown kills all connections and cleans up all goroutines for the peer func (cp *cwtchPeer) Shutdown() { cp.connectionsManager.Shutdown() - cp.app.Shutdown() + if cp.app != nil { + cp.app.Shutdown() + } cp.Save() }