mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +00:00
fix: close conn after read
This commit is contained in:
parent
c7e93e70cc
commit
c6766840d4
1 changed files with 2 additions and 0 deletions
|
|
@ -690,6 +690,7 @@ func (p *PortalProtocol) processContent(target *enode.Node, resp []byte) (byte,
|
||||||
}
|
}
|
||||||
// Read ALL the data from the connection until EOF and return it
|
// Read ALL the data from the connection until EOF and return it
|
||||||
data, err := io.ReadAll(conn)
|
data, err := io.ReadAll(conn)
|
||||||
|
conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.Log.Error("failed to read from utp connection", "err", err)
|
p.Log.Error("failed to read from utp connection", "err", err)
|
||||||
return 0xff, nil, err
|
return 0xff, nil, err
|
||||||
|
|
@ -1189,6 +1190,7 @@ func (p *PortalProtocol) handleOffer(id enode.ID, addr *net.UDPAddr, request *po
|
||||||
// Read ALL the data from the connection until EOF and return it
|
// Read ALL the data from the connection until EOF and return it
|
||||||
var data []byte
|
var data []byte
|
||||||
data, err = io.ReadAll(conn)
|
data, err = io.ReadAll(conn)
|
||||||
|
conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.Log.Error("failed to read from utp connection", "err", err)
|
p.Log.Error("failed to read from utp connection", "err", err)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue