@@ -694,6 +694,7 @@ func (p *PortalProtocol) processContent(target *enode.Node, resp []byte) (byte,
694694 p .Log .Error ("failed to read from utp connection" , "err" , err )
695695 return 0xff , nil , err
696696 }
697+ conn .Close ()
697698 p .Log .Trace ("Received content response" , "id" , target .ID (), "size" , len (data ), "data" , data )
698699 return resp [1 ], data , nil
699700 case portalwire .ContentEnrsSelector :
@@ -1043,6 +1044,7 @@ func (p *PortalProtocol) handleFindContent(id enode.ID, addr *net.UDPAddr, reque
10431044 connIdSend := connId .SendId ()
10441045
10451046 go func (bctx context.Context ) {
1047+ defer p .connIdGen .Remove (connId )
10461048 for {
10471049 select {
10481050 case <- bctx .Done ():
@@ -1165,6 +1167,7 @@ func (p *PortalProtocol) handleOffer(id enode.ID, addr *net.UDPAddr, request *po
11651167 connIdSend := connId .SendId ()
11661168
11671169 go func (bctx context.Context ) {
1170+ defer p .connIdGen .Remove (connId )
11681171 for {
11691172 select {
11701173 case <- bctx .Done ():
@@ -1193,6 +1196,7 @@ func (p *PortalProtocol) handleOffer(id enode.ID, addr *net.UDPAddr, request *po
11931196 p .Log .Error ("failed to read from utp connection" , "err" , err )
11941197 return
11951198 }
1199+ conn .Close ()
11961200 p .Log .Trace ("Received offer content response" , "id" , id , "size" , len (data ), "data" , data )
11971201
11981202 err = p .handleOfferedContents (id , contentKeys , data )
0 commit comments