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.
This commit is contained in:
Arnaud Cogoluègnes 2020-12-04 09:54:21 +01:00
parent c51e060a07
commit db5a5f57e8
No known key found for this signature in database
GPG Key ID: D5C8C4DFAD43AFA8
1 changed files with 5 additions and 1 deletions

View File

@ -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]).