summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Cogoluègnes <acogoluegnes@gmail.com>2018-05-18 11:02:05 +0200
committerArnaud Cogoluègnes <acogoluegnes@gmail.com>2018-05-18 11:02:05 +0200
commit99ea452490a8bed98a8840c604759e189edf0f15 (patch)
tree37d771542bbae92ae84adc521bad9a102972e74b
parentc39524625d0f3dc3cb46b9737093144ee6b21114 (diff)
downloadrabbitmq-server-git-99ea452490a8bed98a8840c604759e189edf0f15.tar.gz
Add client properties to connection.closed events
This commit adds client properties to connection.closed events. The original need was to have only the optional user-provided connection name added to correlate connections between created and closed events, but all the client properties are finally added for the sake of consistency between the 2 events. This commit uses the process dictionary to convey the client properties, as they're not yet available in the connection state when the call to send the closed event is made (in the after block, just after the network connection has been established). Fixes #1596 [#157500358]
-rw-r--r--src/rabbit_reader.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index bae59bd2f2..8b6d640dec 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -387,10 +387,17 @@ start_connection(Parent, HelperSup, Deb, Sock) ->
%% socket w/o delay before termination.
rabbit_net:fast_close(RealSocket),
rabbit_networking:unregister_connection(self()),
- rabbit_core_metrics:connection_closed(self()),
+ rabbit_core_metrics:connection_closed(self()),
+ ClientProperties = case get(client_properties) of
+ undefined ->
+ [];
+ Properties ->
+ Properties
+ end,
rabbit_event:notify(connection_closed, [{name, Name},
{pid, self()},
- {node, node()}])
+ {node, node()},
+ {client_properties, ClientProperties}])
end,
done.
@@ -1130,6 +1137,9 @@ handle_method0(#'connection.start_ok'{mechanism = Mechanism,
Connection2 = augment_connection_log_name(Connection1),
State = State0#v1{connection_state = securing,
connection = Connection2},
+ % adding client properties to process dictionary to send them later
+ % in the connection_closed event
+ put(client_properties, ClientProperties),
auth_phase(Response, State);
handle_method0(#'connection.secure_ok'{response = Response},