Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(session): do not record erroneous session want sends #452

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hannahhoward
Copy link
Contributor

@hannahhoward hannahhoward commented Aug 23, 2023

Goals

Find acceptable fix for #432

Implementation

The basic idea here is there's nothing wrong with the connection event manager -- the problem lies in the fact that the PeerManager never tells the caller it didn't actually send anything cause the peer appeared disconnected. The SessionWantSender in turn updates the state of sent wants based on incorrect assumption something actually happened. This PR deals with the problem by helping the SessionWantSender avoid getting into an incorrect state by not updating its state when SendWants does nothing.

The subsequent connect event should trigger the sending of the WantBlock then.

For discussion

This is just an experiment and a suggestion for someone else to pick up, to help solve #432 more quickly -- I'm not doing the leg work of testing and change log etc

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #452 (86a7a45) into main (303595b) will increase coverage by 0.08%.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #452      +/-   ##
==========================================
+ Coverage   61.22%   61.30%   +0.08%     
==========================================
  Files         205      205              
  Lines       24399    24409      +10     
==========================================
+ Hits        14939    14965      +26     
+ Misses       8016     8004      -12     
+ Partials     1444     1440       -4     
Files Changed Coverage Δ
bitswap/client/internal/session/session.go 82.11% <ø> (ø)
bitswap/client/internal/peermanager/peermanager.go 63.70% <60.00%> (-1.71%) ⬇️
...tswap/client/internal/session/sessionwantsender.go 81.94% <100.00%> (+0.81%) ⬆️

... and 8 files with indirect coverage changes

@rvagg
Copy link
Member

rvagg commented Aug 24, 2023

seems reasonable, aside from probably needing some form of cleanup for cases where the error doesn't ever resolve - we don't want to continue to try this in perpetuity, unless there is already an alternative cleanup mechanism in place for these wants

@hannahhoward
Copy link
Contributor Author

Presumably, the case where the error does not resolve is one where a peer has disconnected, in which case, we will eventually get a disconnected message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants