storagenode/contact: fix connection leak with contact checkin

Change-Id: If86002557144d5d8dbff939d2b6a2dfec6537577
This commit is contained in:
Jeff Wendling 2019-11-06 10:32:14 -07:00
parent f37f28020d
commit ebcd37c572

View File

@ -104,15 +104,19 @@ func (chore *Chore) Run(ctx context.Context) (err error) {
func (chore *Chore) pingSatellite(ctx context.Context, id storj.NodeID) (err error) {
defer mon.Task()(&ctx, id)(&err)
self := chore.service.Local()
address, err := chore.trust.GetAddress(ctx, id)
if err != nil {
return errPingSatellite.Wrap(err)
}
conn, err := chore.dialer.DialAddressID(ctx, address, id)
if err != nil {
return errPingSatellite.Wrap(err)
}
defer func() { err = errs.Combine(err, conn.Close()) }()
_, err = conn.NodeClient().CheckIn(ctx, &pb.CheckInRequest{
Address: self.Address.GetAddress(),
Version: &self.Version,