Summary
When a node's connection is full, it automatically disconnects the new connection. If the connections for all seed nodes is full, the new node will not be able to join the p2p network.
Do you have any solution you want to propose?
If the connections to the node is full, it should send an Addr message before disconnecting, so that the new connected node has a chance to get other nodes that can be connected.
Where in the software does this update applies to?
@gsmachado Although this is a mechanical issue of the p2p network, I think you may be interested in this topic as the node selection can be used here.
It seems suspicious to me from the connection state point of view. As a node I would only expect Addr from the other node after I'd sent GetAddr request and receiving unsolicited Addr IMO should be treated as wrong behavior of the other side of the connection (even though IIRC it currently is handled just fine by the C# code).
Maybe the safer approach would be to drop some older connection in this case? Supposedly the peer of this older connection had already sent GetAddr and got some Addr in response, so it can tolerate that.
Agree with this, related to https://github.com/neo-project/neo/issues/1013
It seems suspicious to me from the connection state point of view. As a node I would only expect
Addrfrom the other node after I'd sentGetAddrrequest and receiving unsolicitedAddrIMO should be treated as wrong behavior of the other side of the connection (even though IIRC it currently is handled just fine by the C# code).
Not sure if the C# code these days does any tracking of outstanding requests versus data received.
on topic;
I like the idea. Last week a neo-python user faced the same issue as described in #1013.
If I understand it correctly the Addr type message will be send before the handshake is completed, right?
Another way is to allow nodes to run in seed mode. A node running in seed mode will actively disconnect the nodes that have received the Addr message after a period of time.
Another way is to allow nodes to run in seed mode. A node running in seed mode will actively disconnect the nodes that have received the
Addrmessage after a period of time.
I'm not sure what that means. What will a node that is not running in seed mode do different?
I thought the proposal is already something like (pseudo);
C#
on_connect(node) {
if (Localnode.connection_count >= settings.max_connections) {
node.send_message(command='addr', address_list);
node.disconnect();
} else {
node.do_handshake();
etc..
}
}
Perhaps include the outcome of #1133 to this improvement.
Perhaps include the outcome of #1133 to this improvement.
Exactly, reason and peers
I can do it if no one want to implement this.
Option 1: Send peers and then disconnect from the newly node.
Option 2: Allow the connection from the newly nodes, and disconnect from the older nodes.
Option 1
Option 1 (adding it the disconnection reason :P)
If the new node dosen't disconnect, it will lead to a lot of connections in the older nodes. Why not option2, the older node disconnects the new connection attached with address list.
fixed in #1154, plz review it
Most helpful comment
I'm not sure what that means. What will a node that is not running in seed mode do different?
I thought the proposal is already something like (pseudo);
C# on_connect(node) { if (Localnode.connection_count >= settings.max_connections) { node.send_message(command='addr', address_list); node.disconnect(); } else { node.do_handshake(); etc.. } }