You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is likely good behavior since a name match does not definitively identify an endpoint since two endpoints could have the same name but be fundamentally different. Situations I could see this legitimately occuring would be.
Two servers accidentally named the same but with different IPC paths
Two clients accidentally named the same (both establishing a connection to the same server)
How can it be fixed?
Ideally, it would be nice for connect_to_endpoint to not error in the case where you are already connected to the requested endpoint.
In the client -> server case this is relatively trivial. We just need to store the whole ConnectionConfig or its contents (name, ipc_path) and return as if the connection were successful if they match, try to connect if there is no name conflict, and throw an error if the name matches but the IPC path does not.
In the server -> client case it's trickier and not clear how we would correctly identify if the client is indeed the same one. We can potentially divide this up into two cases for clarity but I believe they both pose the same challenge.
two same named clients connect to a server
a server has an existing client with the name and then tries to establish a connection to another serving endpoint with that name.
One potential way to reconcile this would be to define client identity as something like (process-id, name).
However, we probably still must keep the invariant that an endpoint may only ever have a unique set of endpoint names that it is connected to, since allowing multiple same named clients would change the assumptions about broadcasts which are specifically routed to an endpoint having a single recipient, and introduce things like race conditions in a request/response scenario.
The text was updated successfully, but these errors were encountered:
What was wrong?
Right now, if you try to connect to an endpoint you are already connected to
lahja
throws an error:https://github.com/ethereum/lahja/blob/master/lahja/asyncio/endpoint.py#L484
This is likely good behavior since a name match does not definitively identify an endpoint since two endpoints could have the same name but be fundamentally different. Situations I could see this legitimately occuring would be.
How can it be fixed?
Ideally, it would be nice for
connect_to_endpoint
to not error in the case where you are already connected to the requested endpoint.In the
client -> server
case this is relatively trivial. We just need to store the wholeConnectionConfig
or its contents (name
,ipc_path
) and return as if the connection were successful if they match, try to connect if there is no name conflict, and throw an error if the name matches but the IPC path does not.In the
server -> client
case it's trickier and not clear how we would correctly identify if the client is indeed the same one. We can potentially divide this up into two cases for clarity but I believe they both pose the same challenge.One potential way to reconcile this would be to define client identity as something like
(process-id, name)
.However, we probably still must keep the invariant that an endpoint may only ever have a unique set of endpoint names that it is connected to, since allowing multiple same named clients would change the assumptions about broadcasts which are specifically routed to an endpoint having a single recipient, and introduce things like race conditions in a request/response scenario.
The text was updated successfully, but these errors were encountered: