From a2f7170ff0ddc55e5c6b200a67848a62511ef9e4 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 7 May 2018 20:31:22 -0700 Subject: [PATCH] peer: make Disconnect async, block on WaitForDisconnect --- peer.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/peer.go b/peer.go index ad9dc946..b95aedb1 100644 --- a/peer.go +++ b/peer.go @@ -456,7 +456,7 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error { // disconnected if the local or remote side terminating the connection, or an // irrecoverable protocol error has been encountered. func (p *peer) WaitForDisconnect() { - <-p.quit + p.wg.Wait() } // Disconnect terminates the connection with the remote peer. Additionally, a @@ -473,8 +473,6 @@ func (p *peer) Disconnect(reason error) { p.conn.Close() close(p.quit) - - p.wg.Wait() } // String returns the string representation of this peer.