Skip to content

Commit

Permalink
peer: make Disconnect async, block on WaitForDisconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
cfromknecht committed May 8, 2018
1 parent 84c0055 commit 891db4d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions peer.go
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 891db4d

Please sign in to comment.