Close downstream connections when upstream connection closes.#220
Close downstream connections when upstream connection closes.#220markusgust merged 4 commits intomainfrom
Conversation
snichme
left a comment
There was a problem hiding this comment.
What will happen if you have many connections to the proxy which will generate one connection but many channels to the broker and if one connections sends a close frame, wont that close the whole connection between proxy and broker affecting all connections to the proxy?
|
if a client send a close frame to the proxy, then this code shouldn't be reached I believe, as it'll instead go here: amqproxy/src/amqproxy/client.cr Line 57 in 851c7df This is only if the upstream connection terminates, in which case all clients connected over the upstream connections will receive connection_close instead of channel_close. |
|
only time I do think this might be destructive is if a client make a connection to a proxy, and this same connection creates channels on different upstream connections (different brokers). But I don't know if that's a possible scenario? |
snichme
left a comment
There was a problem hiding this comment.
Thank you for the clarification. I initally thought this was for the upstream connections (based on the filename) but after your explanation it cleared things up.
Makes sense to close the client connection if the broker closes the connection and I agree that the scenario where one connection opens different channels to different brokers shouldn't be possible.
I've tried it locally and works as expected.
Currently when upstream connection closes we close the channels on the downstream connections, which is a change in how v1.0.0 used to work. This PR instead closes downstream connections when upstream closes, which makes it easier for clients to reconnect on closed connections.