mirror of https://github.com/BTCPrivate/lnd.git
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:
parent
0ef36dca9b
commit
00a7f140ff
8
peer.go
8
peer.go
|
@ -319,7 +319,13 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||||
return nil
|
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
|
// Disconnect terminates the connection with the remote peer. Additionally, a
|
||||||
// signal is sent to the server and htlcSwitch indicating the resources
|
// signal is sent to the server and htlcSwitch indicating the resources
|
||||||
|
|
Loading…
Reference in New Issue