Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Ignored error in PeerSendWants #316

Closed
Stebalien opened this issue Mar 24, 2020 · 1 comment · Fixed by #325
Closed

Ignored error in PeerSendWants #316

Stebalien opened this issue Mar 24, 2020 · 1 comment · Fixed by #325
Assignees
Labels
kind/support A question or request for support

Comments

@Stebalien
Copy link
Member

What happens if OK is false? Is this possible? Just ignoring the error and moving on seems like a bad idea.

// Get the existing want-blocks and want-haves for the peer
if pws, ok := pwm.peerWants[p]; ok {
// Iterate over the requested want-blocks

@Stebalien Stebalien added the kind/support A question or request for support label Mar 24, 2020
@dirkmc
Copy link
Contributor

dirkmc commented Mar 24, 2020

In practice this shouldn't be possible. We add the peer to PeerWantManager as soon as we have a connection, and remove it as soon as the last connection is cleaned up:

// If this is the first connection to the peer
if pq.refcnt == 1 {
// Inform the peer want manager that there's a new peer
pm.pwm.AddPeer(p)
// Record that the want-haves are being sent to the peer
pm.pwm.PrepareSendWants(p, nil, initialWantHaves)

if pq.refcnt > 0 {
return
}
// Inform the sessions that the peer has disconnected
pm.signalAvailability(p, false)
// Clean up the peer
delete(pm.peerQueues, p)
pq.pq.Shutdown()
pm.pwm.RemovePeer(p)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/support A question or request for support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants