summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Cogoluègnes <acogoluegnes@gmail.com>2020-12-04 09:54:21 +0100
committerArnaud Cogoluègnes <acogoluegnes@gmail.com>2020-12-04 09:54:21 +0100
commitdb5a5f57e835ac1b41553df4fb7179905d08ab25 (patch)
treed8396ee44b22e9b14f6314a208f346bccff331b5
parentc51e060a0729d3381c954a9f0d0218a1e9a3c747 (diff)
downloadrabbitmq-server-git-db5a5f57e835ac1b41553df4fb7179905d08ab25.tar.gz
Send shutdown message to non network/direct connection
Connections to the stream plugin does not have a type, so they can trigger some function_clause errors. This was the case when trying to close a connection from rabbit_connection_tracking module. The function now falls back to a simple gen_server call to the connection process for connections without a type.
-rw-r--r--deps/rabbit/src/rabbit_connection_tracking.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/deps/rabbit/src/rabbit_connection_tracking.erl b/deps/rabbit/src/rabbit_connection_tracking.erl
index c0704e6a7c..02ef4275be 100644
--- a/deps/rabbit/src/rabbit_connection_tracking.erl
+++ b/deps/rabbit/src/rabbit_connection_tracking.erl
@@ -512,4 +512,8 @@ close_connection(#tracked_connection{pid = Pid, type = network}, Message) ->
close_connection(#tracked_connection{pid = Pid, type = direct}, Message) ->
%% Do an RPC call to the node running the direct client.
Node = node(Pid),
- rpc:call(Node, amqp_direct_connection, server_close, [Pid, 320, Message]).
+ rpc:call(Node, amqp_direct_connection, server_close, [Pid, 320, Message]);
+close_connection(#tracked_connection{pid = Pid}, Message) ->
+ % best effort, this will work for connections to the stream plugin
+ Node = node(Pid),
+ rpc:call(Node, gen_server, call, [Pid, {shutdown, Message}, infinity]).