peer: add WaitForDisconnect method

This commit adds a new method to the peer struct: WaitForDisconnect().
This method is put in place to be used by wallers to synchronize the
ending of a peer’s lifetime. A follow up commit will utilize this new
method to re-write the way we handle persistent peer connections.
This commit is contained in:
Olaoluwa Osuntokun 2017-04-23 19:29:38 -07:00
parent 0ef36dca9b
commit 00a7f140ff
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 7 additions and 1 deletions

View File

@ -319,7 +319,13 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
return nil
}
// TODO(roasbeef): add WaitForShutdown method
// WaitForDisconnect waits until the peer has disconnected. A peer may be
// disconnected if the local or remote side terminating the connection, or an
// irrecoverable protocol error has been encountered.
func (p *peer) WaitForDisconnect() {
<-p.quit
}
// Disconnect terminates the connection with the remote peer. Additionally, a
// signal is sent to the server and htlcSwitch indicating the resources