Closed avieth closed 7 years ago
Rebased, ready for another review.
LGTM It has some conflicts.
@facundominguez Conflicts resolved. I squashed everything and then threw on one more commit implementing the simplification that you pointed out.
One test failed. I think this patch fixes it https://github.com/haskell-distributed/network-transport-tests/pull/13 let me know if you agree.
Thanks @avieth!
This makes it feasible to run a transport on a machine that isn't addressable from the network in which its peers live. Endpoints on this transport can connect to the addressable peers, but the peers can only connect to that endpoint if there's already a socket opened. Endpoints on the same unaddressable transport cannot connect to each-other, even though it's technically possible.
Unaddressable endpoints are given (random) UUIDv4 addresses. When an addressable endpoint receives a connection from an unaddressable peer, it generates one to identify that peer locally (highly unlikely that any other peer would make sense of that address). This is the address found on the
ConnectionOpened
event.The connection request protocol (for the socket, not for lightweight connections) is changed: sending a 0-length address (just the length-prefix
0x00000000
) means no address is coming. Anything else will be read and parsed to anEndPointAddress
. This is backwards compatible assuming empty ByteString is not a validEndPointAddress
.