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

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Aug 13, 2015
2 parents c0d70af + 521f77c commit 70af06d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/rabbit_federation_queue_link.erl
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,26 @@ update_headers(#upstream_params{table = Table}, Redelivered, X, K, Headers) ->
%% routing key the first time a message gets
%% forwarded; after that it's known that they were
%% <<>> and QueueName respectively.
{rabbit_misc:set_table_value(
rabbit_misc:set_table_value(
Headers, <<"x-original-exchange">>, longstr, X),
<<"x-original-routing-key">>, longstr, K), 0};
{init_x_original_source_headers(Headers, X, K), 0};
{array, Been} ->
update_visit_count(Table, Been, Headers);
%% this means the header comes from the client
%% which re-published the message. We can't assume
%% much about the headers so we simply wrap it in
%% an array
Other ->
update_visit_count(Table, [Other], Headers)
%% which re-published the message, most likely unintentionally.
%% We can't assume much about the value, so we simply ignore it.
_Other ->
{init_x_original_source_headers(Headers, X, K), 0}
end,
rabbit_basic:prepend_table_header(
?ROUTING_HEADER, Table ++ [{<<"redelivered">>, bool, Redelivered},
{<<"visit-count">>, long, Count + 1}],
swap_cc_header(Headers1)).

init_x_original_source_headers(Headers, X, K) ->
rabbit_misc:set_table_value(
rabbit_misc:set_table_value(
Headers, <<"x-original-exchange">>, longstr, X),
<<"x-original-routing-key">>, longstr, K).

update_visit_count(Table, Been, Headers) ->
{Found, Been1} = lists:partition(
fun(I) -> visit_match(I, Table) end,
Expand Down

0 comments on commit 70af06d

Please sign in to comment.