-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add a registerListener() API #645
Conversation
It was the only method with a unique name, but it was not doing any "handshaking" and was only retrieving the public key.
To allow incoming connections from nodes outside the known network list.
For future incoming connections, we will: - skip network discovery, as that connection may be untrusted - not automatically register as a listener
An outsider node which is not part of the network config of a given node will not receive any gossiping. This is a misdesign, and will be fixed in the next commit.
Codecov Report
@@ Coverage Diff @@
## v0.x.x #645 +/- ##
==========================================
+ Coverage 90.02% 90.11% +0.08%
==========================================
Files 62 62
Lines 4591 4622 +31
==========================================
+ Hits 4133 4165 +32
+ Misses 458 457 -1
Continue to review full report at Codecov.
|
By the way, I know this is not an ideal API. Anyone can pass any address string here. It's possible to extract the address from the connection which invoked an API with vibe.d. But for LocalRest it would require additional work. And I'm not sure what the best design would be. So maybe we could keep |
source/agora/network/NetworkClient.d
Outdated
|
||
***************************************************************************/ | ||
|
||
public void handshake () | ||
public void registerListener (string address) |
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.
public void registerListener (string address) | |
public void registerListener (Address address) |
Can you tell why used string 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.
Oh I made a mistake while rebasing commits. I'll fix it.
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.
Nice catch!
If a Node wants to listen for Gossip / Consensus messages, it needs to register itself as a listener. Previously a Node would gossip its messages to other nodes only if those nodes were in the network configuration of the Node. Part of: bosagora#606
e4c2904
to
0f868bf
Compare
Fixed string => address. |
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.
Nice code!
And, I'd like to know what is the worst thing when an outsider participates in the gossip protocol. I mean what happend in the worst case.
This was hard to pull off because of the complex design of the NetworkManager class (see #644).
Split off from #621
Part of #606 (but does not fully resolve it yet).