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

fix: always send the result channel when triggering a refresh #425

Merged
merged 1 commit into from Dec 13, 2019

Conversation

Stebalien
Copy link
Member

Otherwise, we'll just return a channel that will never be signaled.

Otherwise, we'll just return a channel that will never be signaled.
case dht.triggerRtRefresh <- res:
default:
}
dht.triggerRtRefresh <- res
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the triggerRtRefresh channel buffered?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not. But, the reader drains all the reqs on the channel before proceeding so it can signal the result of the refresh to all "simultaneous" callers.

However, what could happen here is that if a refresh is already in progress, all callers of RefreshRoutingTable will block till the current refresh round finishes and then trigger yet another refresh.

@Stebalien Are we okay with that ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the intended behavior, at least for the moment. I want to be able to:

  1. Connect to a peer.
  2. Trigger a refresh that uses that peer.

That means I want the refresh to start after I call the function and I don't want to count any refreshes that started before.

@Stebalien Stebalien merged commit dd3d8fb into master Dec 13, 2019
@Stebalien Stebalien deleted the fix/refresh-wait branch December 13, 2019 09:32
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.

None yet

4 participants