Closed CDKnightNASA closed 4 years ago
Model should be that when a node connects out, it sends a brief header identifying its CPU ID. On the other side, the "server" should set aside the new socket and wait for the header and not assign it to a peer until that header has been received/confirmed.
As an interim you might want to consider comparing IP+Port instead of just IP (and of course binding to a specific port on each side of the connection).
just committed a fix that disassociates peer sockets on the receive side and associates the connections to peers for sending when the peer is identified by the first message received.
The way the TCP module (currently) determines which peer has connected is by comparing the IP address of the new connection with the IP address of the peer. But if there are multiple peers connecting from the same IP address (such as if you have more than 2 nodes locally that are all using localhost) this will cause an issue.