Skip to content

Commit

Permalink
fix:fix delete no lock
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <281165273grape@gmail.com>
  • Loading branch information
GrapeBaBa committed Jun 18, 2024
1 parent 6a01b9b commit 13e8f62
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions p2p/discover/portal_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ func (p *PortalProtocol) pingInner(node *enode.Node) (*portalwire.Pong, error) {
talkResp, err := p.DiscV5.TalkRequest(node, p.protocolId, talkRequestBytes)

if err != nil {
p.deleteNode(node)
return nil, err
}

Expand Down Expand Up @@ -787,7 +786,6 @@ func (p *PortalProtocol) processPong(target *enode.Node, resp []byte) (*portalwi
pong := &portalwire.Pong{}
err := pong.UnmarshalSSZ(resp[1:])
if err != nil {
p.deleteNode(target)
return nil, err
}

Expand All @@ -796,7 +794,6 @@ func (p *PortalProtocol) processPong(target *enode.Node, resp []byte) (*portalwi
customPayload := &portalwire.PingPongCustomData{}
err = customPayload.UnmarshalSSZ(pong.CustomPayload)
if err != nil {
p.deleteNode(target)
return nil, err
}

Expand All @@ -807,11 +804,6 @@ func (p *PortalProtocol) processPong(target *enode.Node, resp []byte) (*portalwi
return pong, nil
}

func (p *PortalProtocol) deleteNode(target *enode.Node) {
b := p.table.bucket(target.ID())
p.table.deleteInBucket(b, target.ID())
}

func (p *PortalProtocol) handleUtpTalkRequest(id enode.ID, addr *net.UDPAddr, msg []byte) []byte {
if n := p.DiscV5.getNode(id); n != nil {
p.table.addInboundNode(n)
Expand Down

0 comments on commit 13e8f62

Please sign in to comment.