-
Notifications
You must be signed in to change notification settings - Fork 13
Simplify ClientConnection implementation #2418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ClientConnection, unlike ConnectionCache, serializes connections to the server and I believe it is a feature we should keep. See also my blog: https://zeroc.atlassian.net/wiki/spaces/~bernard/blog/2023/01/02/1211039772/January+2+2023 |
I think the 2 decorators used for the implementation of ClientConnection are appropriate. The ConnectProtocolConnectionDecorator makes sure we only InvokeAsync on a connected connection, even when:
ConnectionCache is simpler in this respect because it does not need to worry about application code calling ConnectAsync. The CleanupProtocolConnectionDecorator makes sure we ConnectAsync a connection only have the cleanup of the previous connection is completed. And in case we never call ConnectAsync on that connection, its DisposeAsync will await the cleanup of the previous connection. ConnectionCache doesn't provide this connection serialization feature. It's certainly possible to do the same without decorators but I doubt it would be simpler or clearer. |
It's not obvious to me why it's a feature we should keep, can you explain why? |
The alternative - no serialization like ConnectionCache - would mean:
I think it's cleaner and clearer to serialize. |
I find it's minor and it's still unclear to me why client connection / connection cache should behave differently in this respect. |
To me, it should be a "simplified" connection cache implementation. It should keep track of the pending connect (
_pendingConnectTask
), the active connection (_activeConnection
) and the background connection dispose count (_backgroundConnectionDisposeCount
). No need for decorators.Originally posted by @bentoi in #2396 (review)
The text was updated successfully, but these errors were encountered: