pubsubpeer better address management
This commit is contained in:
parent
7b2727d930
commit
c1334c6d89
|
@ -169,12 +169,18 @@ proc connectOnce(p: PubSubPeer): Future[void] {.async.} =
|
||||||
finally:
|
finally:
|
||||||
if p.sendConn != nil:
|
if p.sendConn != nil:
|
||||||
trace "Removing send connection", p, conn = p.sendConn
|
trace "Removing send connection", p, conn = p.sendConn
|
||||||
|
|
||||||
await p.sendConn.close()
|
await p.sendConn.close()
|
||||||
|
|
||||||
p.sendConn = nil
|
try:
|
||||||
p.address = none(MultiAddress)
|
|
||||||
if p.onEvent != nil:
|
if p.onEvent != nil:
|
||||||
p.onEvent(p, PubsubPeerEvent(kind: PubSubPeerEventKind.Disconnected))
|
p.onEvent(p, PubsubPeerEvent(kind: PubSubPeerEventKind.Disconnected))
|
||||||
|
except CancelledError as exc:
|
||||||
|
debug "Errors during diconnection events", error = exc.msg
|
||||||
|
|
||||||
|
# clean up at the end
|
||||||
|
p.sendConn = nil
|
||||||
|
# don't cleanup p.address else we leak some gossip stat table
|
||||||
|
|
||||||
proc connectImpl(p: PubSubPeer) {.async.} =
|
proc connectImpl(p: PubSubPeer) {.async.} =
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue