Merge pull request #115 from libp2p/cleanup-peerstore

clean up dialer peerstore after each dial
This commit is contained in:
Marten Seemann 2021-12-10 14:26:00 +04:00 committed by GitHub
commit 60188e3c1c
1 changed files with 6 additions and 0 deletions

View File

@ -192,6 +192,12 @@ func (as *autoNATService) doDial(pi peer.AddrInfo) *pb.Message_DialResponse {
as.config.dialer.Peerstore().ClearAddrs(pi.ID)
as.config.dialer.Peerstore().AddAddrs(pi.ID, pi.Addrs, peerstore.TempAddrTTL)
defer func() {
as.config.dialer.Peerstore().ClearAddrs(pi.ID)
as.config.dialer.Peerstore().RemovePeer(pi.ID)
}()
conn, err := as.config.dialer.DialPeer(ctx, pi.ID)
if err != nil {
log.Debugf("error dialing %s: %s", pi.ID.Pretty(), err.Error())