mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
peer: make Disconnect async, block on WaitForDisconnect
This commit is contained in:
parent
8c04dd0030
commit
a2f7170ff0
1 changed files with 1 additions and 3 deletions
4
peer.go
4
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
|
// disconnected if the local or remote side terminating the connection, or an
|
||||||
// irrecoverable protocol error has been encountered.
|
// irrecoverable protocol error has been encountered.
|
||||||
func (p *peer) WaitForDisconnect() {
|
func (p *peer) WaitForDisconnect() {
|
||||||
<-p.quit
|
p.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect terminates the connection with the remote peer. Additionally, a
|
// Disconnect terminates the connection with the remote peer. Additionally, a
|
||||||
|
@ -473,8 +473,6 @@ func (p *peer) Disconnect(reason error) {
|
||||||
p.conn.Close()
|
p.conn.Close()
|
||||||
|
|
||||||
close(p.quit)
|
close(p.quit)
|
||||||
|
|
||||||
p.wg.Wait()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the string representation of this peer.
|
// String returns the string representation of this peer.
|
||||||
|
|
Loading…
Add table
Reference in a new issue