From db5a5f57e835ac1b41553df4fb7179905d08ab25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Fri, 4 Dec 2020 09:54:21 +0100 Subject: 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. --- deps/rabbit/src/rabbit_connection_tracking.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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]). -- cgit v1.2.1