peer: make Disconnect async, block on WaitForDisconnect

This commit is contained in:
Conner Fromknecht 2018-05-07 20:31:22 -07:00
parent 8c04dd0030
commit a2f7170ff0
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

@ -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.