Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Connection re-registration after network split WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Jul 6, 2016
1 parent 9cc96f0 commit 26bff83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/rabbit_networking.erl
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,13 @@ node_listeners(Node) ->

on_node_down(Node) ->
case lists:member(Node, nodes()) of
false -> ok = mnesia:dirty_delete(rabbit_listener, Node);
true -> rabbit_log:info(
"Keep ~s listeners: the node is already back~n", [Node])
false ->
rabbit_log:info(
"Node ~s is down, deleting its listeners~n", [Node]),
ok = mnesia:dirty_delete(rabbit_listener, Node);
true ->
rabbit_log:info(
"Keeping ~s listeners: the node is already back~n", [Node])
end.

register_connection(Pid) -> pg_local:join(rabbit_connections, Pid).
Expand Down
5 changes: 5 additions & 0 deletions src/rabbit_reader.erl
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ handle_other({channel_exit, Channel, Reason}, State) ->
handle_exception(State, Channel, Reason);
handle_other({'DOWN', _MRef, process, ChPid, Reason}, State) ->
handle_dependent_exit(ChPid, Reason, State);
%% We were asked to re-register in rabbit_tracked_connection.
%% See rabbit_connection_tracking, rabbit_connection_tracker.
handle_other(reregister, State = #v1{connection = ConnState}) ->
rabbit_event:notify(connection_reregistered, [{state, ConnState}]),
State;
handle_other(terminate_connection, State) ->
maybe_emit_stats(State),
stop;
Expand Down

0 comments on commit 26bff83

Please sign in to comment.