-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Currently, packers and transporters are closely coupled in the New*ClientHandler
. This creates problems when sharing a single physical connection (part of the transporter) amongst multiple clients where each client talks to a different slave id (part of the packager). The current api makes it impossible to implement race-free concurrent access.
While packager and transporter already have distinct purposes, the respective types cannot be created individually from outside the library as the types are not public. Using NewClient2
is cumbersome as the required packager/transporter types both need be created taking an address as parameter which is pointless for a packager.
This PR makes the packager/transporter types public and hence allows re-using the transporter while creating immutable packagers per slave id.
/cc @frzifus @gq0 @hsteidl could I kindly ask you to take a look at the attached PR? It is not finished but clearly demonstrates the approach. It exposes quite a bit of additional (though not su useful) api with the packager and transporter types. Maybe we can come up with a more trimmed approach, I'd be happy to update the PR with any suggestions.
Note: I like the approach from #70 much more as it is much less invasive and introduces very little additional api.