-
Notifications
You must be signed in to change notification settings - Fork 1k
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
When one side connect actively, the other side will always keep trying a new connection #1123
Comments
It is great to see you are investigating this. I will take a carefull look. |
fixed by #1124 |
I think this is as expected. Why do we want to allow duplicate connections? |
I mean, there is not need for B to connect A again, when A has connected B. |
I think that we should use Why A don't send a neo/neo/Network/P2P/MessageCommand.cs Line 26 in c4023a4
|
|
I think there is no need to send a |
Why we don't use unique Id |
I am configuring the scenario and the text is wrong @Tommo-L foreach (IPEndPoint connected in ConnectedPeers)
{
Console.WriteLine("--- connected " + connected.ToString()); // <--- here
} should be foreach (IPEndPoint connected in ConnectedPeers.Values)
{
Console.WriteLine("--- connected " + connected.ToString()); // <--- here
} |
Two nodes aren't enough, you need 3 nodes at least. In my environment, I have 4 nodes in different hosts. Why two nodes aren't enough, the work flow as following: Lines 229 to 230 in c4023a4
Step3: B timeout#2, but this time, UnconnectedPeers is empty, then B will broadcast GetAddr message to get new unconnected peers.
Lines 224 to 228 in c4023a4
neo/neo/Network/P2P/LocalNode.cs Lines 124 to 130 in c4023a4
Step4: However, when A received neo/neo/Network/P2P/ProtocolHandler.cs Lines 145 to 155 in c4023a4
Step5: B received the address list from A, it's only the address of B. And it will be filter by B. neo/neo/Network/P2P/ProtocolHandler.cs Lines 119 to 125 in c4023a4
Lines 65 to 72 in c4023a4
Finally, the |
Another way is to add a |
I think that is better with |
fixed in #1154, plz review it |
Describe the bug
If neo node A and B both listen port 40333, and A connected B firstly. At this time, B will always try to create a new connection from B to A with timer.
But when the new connection created, and B sent the
VersionPlayload
to A, A will close the connection at once, as A have connected B.neo/neo/Network/P2P/RemoteNode.cs
Lines 211 to 216 in c4023a4
To Reproduce
Steps to reproduce the behavior:
Evn.: 4 four nodes in different hosts.
add log in RemoteNode.PostStop
add log in Peer.OnTimer
Expected behavior
When A connected B, B dose not need to create a new connection between B and A unless the original connection crashed.
Screenshots
B's ip is 192.168.1.147, and A's ip is 192.168.1.149. A connected B firstly. As you can see, B will try to create a connection with timer.
Platform:
How to solve?
The reason is that A dosen't use the listener port 40333 but other port to connect B, but B will treat the
{A's ip}:40333
as a new node, and try to connect it.When A connect B, B must also add the
{A's ip}:{A's listener port}
in its connected peers.The text was updated successfully, but these errors were encountered: