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: improve error handling in dual dht #582

Merged
merged 1 commit into from
Apr 10, 2020
Merged

Conversation

Stebalien
Copy link
Member

  1. FindPeer should succeed as long as we find the peer in one DHT.
  2. If we get a kbucket error from one DHT, return the error from the other DHT.
  3. Avoid returning the same error twice.

1. FindPeer should succeed as long as we find the peer in one DHT.
2. If we get a kbucket error from one DHT, return the error from the other DHT.
3. Avoid returning the same error twice.

func combineErrors(erra, errb error) error {
// if the errors are the same, just return one.
if erra == errb {
Copy link
Contributor

Choose a reason for hiding this comment

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

can 2 instances of the same error not be ==? will this do string equality (which should be safe)?

Copy link
Member Author

Choose a reason for hiding this comment

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

This won't do string equality, but I really just care if they're the same. E.g., "ErrNotFound", "ErrNotSupported", etc. Unfortunately, this is just a heuristic to improve the errors a bit.

@Stebalien Stebalien merged commit 7e74bc8 into master Apr 10, 2020
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