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
Find specific peer from network #981
Conversation
Codecov Report
@@ Coverage Diff @@
## main #981 +/- ##
==========================================
+ Coverage 88.79% 88.89% +0.10%
==========================================
Files 319 320 +1
Lines 28130 28132 +2
==========================================
+ Hits 24977 25007 +30
+ Misses 1602 1597 -5
+ Partials 1551 1528 -23
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of directly referring to the constant Kademlia.FindConcurrency
from KademliaProtocol
, how about making KademliaProtocol()
constructor to take that value?
@@ -708,53 +714,35 @@ private void ReceivePing(Ping ping) | |||
{ | |||
await Task.WhenAll(awaitables); | |||
} | |||
catch (AggregateException e) | |||
catch (Exception e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@limebell What kind of exceptions do you expect to be thrown here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually TimeoutException
, which occurs when the received peer is not alive actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made TimeoutException
(which is replaced by PingTimeoutException
) to remove peer from lookup candidate, which will be covered by SwarmTest.FindSpecificPeerAsyncFail()
test.
{ | ||
peerFound = closestNeighbors[i]; | ||
return peerFound; | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be difficult to have a unit test for this case?
4070cfa
to
5002ceb
Compare
5002ceb
to
bd759ac
Compare
Method implemented in this PR keeps searching even the specific target is found. I will add some commits on this PR to fix the issue. Until then, leave title as WIP. |
3e5a10c
to
b82d753
Compare
Used DFS beforehand, may cause stack overflow. So I changed it to BFS by using concurrent queue and stop immediately when target peer is found. However |
f015aec
to
7096e7a
Compare
17d3614
to
4b0e7d4
Compare
Co-authored-by: Hong Minhee (洪 民憙) <hong.minhee@gmail.com>
PingAsync now throws PingTimeoutException instead of TimeoutException [skip changelog]
Co-authored-by: Seunghun Lee <waydi1@gmail.com>
Co-authored-by: Hong Minhee (洪 民憙) <hong.minhee@gmail.com>
Co-authored-by: Swen Mun <longfinfunnel@gmail.com>
Co-authored-by: Swen Mun <longfinfunnel@gmail.com>
4b0e7d4
to
44c6e12
Compare
There was
Swarm<T>.FindSpecificPeerAsync()
method but it was not precise. This PR makes it to work more precisely.