Skip to content

Commit c676684

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
fix: close conn after read
1 parent c7e93e7 commit c676684

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

p2p/discover/portal_protocol.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ func (p *PortalProtocol) processContent(target *enode.Node, resp []byte) (byte,
690690
}
691691
// Read ALL the data from the connection until EOF and return it
692692
data, err := io.ReadAll(conn)
693+
conn.Close()
693694
if err != nil {
694695
p.Log.Error("failed to read from utp connection", "err", err)
695696
return 0xff, nil, err
@@ -1189,6 +1190,7 @@ func (p *PortalProtocol) handleOffer(id enode.ID, addr *net.UDPAddr, request *po
11891190
// Read ALL the data from the connection until EOF and return it
11901191
var data []byte
11911192
data, err = io.ReadAll(conn)
1193+
conn.Close()
11921194
if err != nil {
11931195
p.Log.Error("failed to read from utp connection", "err", err)
11941196
return

0 commit comments

Comments
 (0)