Closed tomcucinotta closed 12 months ago
temporary remedy for one of the problems related to this issue: 7f0e9400
just sketched a few sequence diagrams to depict possible scenarios that would need to be properly handled, see commit 9254f1d, and the .puml files added in https://github.com/tomcucinotta/distwalk/tree/master/doc
this is partially addressed and at the same time obsoleted by the reqs[] array introduced in 99f041cf8, and the accompanying rework as from #19.
If I have a client asking its server node s to forward the request to a node n, and then another client asking the same server node s to forward the request to the same node n, then we'd try to reuse the socket already established between s and n, for the second client request. However, as n will reply onto the same socket, when the result comes back from the socket, we need to differentiate which client the answer is for. This is a case that cannot be handled in the current forward() code sketch, because a client sends a forward, expecting its reply back from that socket, but the reply could actually be for someone else. In the shortest term, to recover consistency, we should instantiate the socks[] cache to be per-client (thread). However, this case could be handled properly with a forward integrated properly within the epoll() machinery.