clean up dialer peerstore after each dial

This commit is contained in:
Marten Seemann 2021-12-10 10:58:02 +04:00
parent 287375a12e
commit d70ee3daf2
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())