diff options
| author | Matthias Radestock <matthias@lshift.net> | 2008-12-18 14:04:59 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@lshift.net> | 2008-12-18 14:04:59 +0000 |
| commit | 9187386298c36c771573759a11546848a2e973ba (patch) | |
| tree | a65539e0e2b9ce3eddbd235e42fc3ea900970216 /src | |
| parent | 6266723f81a44b5dcd29679c0815623a4a80b276 (diff) | |
| parent | 7c68f363208aa7d7b8cb44c4e4e0d378bf046d29 (diff) | |
| download | rabbitmq-server-git-9187386298c36c771573759a11546848a2e973ba.tar.gz | |
merge default into bug18557
and add license notice on rabbit_limiter
Diffstat (limited to 'src')
38 files changed, 1039 insertions, 343 deletions
diff --git a/src/buffering_proxy.erl b/src/buffering_proxy.erl index fcb7b412e2..344b719a3c 100644 --- a/src/buffering_proxy.erl +++ b/src/buffering_proxy.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit.erl b/src/rabbit.erl index 195dd729bd..41064c772c 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -157,8 +163,9 @@ start(normal, []) -> ok = rabbit_amqqueue:start(), - ok = rabbit_alarm:start(), - + {ok, MemoryAlarms} = application:get_env(memory_alarms), + ok = rabbit_alarm:start(MemoryAlarms), + ok = rabbit_binary_generator: check_empty_content_body_frame_size(), diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 4342e15b3b..b73090fc44 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -197,7 +203,7 @@ delete_vhost(VHostPath) -> lists:foreach(fun (Q) -> {ok,_} = rabbit_amqqueue:delete(Q, false, false) end, - rabbit_amqqueue:list_vhost_queues(VHostPath)), + rabbit_amqqueue:list(VHostPath)), R = rabbit_misc:execute_mnesia_transaction( rabbit_misc:with_vhost( VHostPath, @@ -211,7 +217,7 @@ internal_delete_vhost(VHostPath) -> lists:foreach(fun (#exchange{name=Name}) -> ok = rabbit_exchange:delete(Name, false) end, - rabbit_exchange:list_vhost_exchanges(VHostPath)), + rabbit_exchange:list(VHostPath)), lists:foreach(fun (Username) -> ok = unmap_user_vhost(Username, VHostPath) end, diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index 6d65b3a407..7bbed8b715 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -27,7 +33,7 @@ -behaviour(gen_event). --export([start/0, stop/0, register/2]). +-export([start/1, stop/0, register/2]). -export([init/1, handle_call/2, handle_event/2, handle_info/2, terminate/2, code_change/3]). @@ -41,7 +47,7 @@ -ifdef(use_specs). -type(mfa_tuple() :: {atom(), atom(), list()}). --spec(start/0 :: () -> 'ok'). +-spec(start/1 :: (bool()) -> 'ok'). -spec(stop/0 :: () -> 'ok'). -spec(register/2 :: (pid(), mfa_tuple()) -> 'ok'). @@ -49,58 +55,15 @@ %%---------------------------------------------------------------------------- -start() -> - ok = alarm_handler:add_alarm_handler(?MODULE), +start(MemoryAlarms) -> + ok = alarm_handler:add_alarm_handler(?MODULE, [MemoryAlarms]), case whereis(memsup) of - undefined -> - Mod = case os:type() of - %% memsup doesn't take account of buffers or - %% cache when considering "free" memory - - %% therefore on Linux we can get memory alarms - %% very easily without any pressure existing on - %% memory at all. Therefore we need to use our - %% own simple memory monitor. - %% - {unix, linux} -> rabbit_memsup_linux; - - %% Start memsup programmatically rather than via - %% the rabbitmq-server script. This is not quite - %% the right thing to do as os_mon checks to see - %% if memsup is available before starting it, - %% but as memsup is available everywhere (even - %% on VXWorks) it should be ok. - %% - %% One benefit of the programmatic startup is - %% that we can add our alarm_handler before - %% memsup is running, thus ensuring that we - %% notice memory alarms that go off on startup. - %% - _ -> memsup - end, - %% This is based on os_mon:childspec(memsup, true) - {ok, _} = supervisor:start_child( - os_mon_sup, - {memsup, {Mod, start_link, []}, - permanent, 2000, worker, [Mod]}), - ok; - _ -> - ok - end, - %% The default memsup check interval is 1 minute, which is way too - %% long - rabbit can gobble up all memory in a matter of seconds. - %% Unfortunately the memory_check_interval configuration parameter - %% and memsup:set_check_interval/1 function only provide a - %% granularity of minutes. So we have to peel off one layer of the - %% API to get to the underlying layer which operates at the - %% granularity of milliseconds. - %% - %% Note that the new setting will only take effect after the first - %% check has completed, i.e. after one minute. So if rabbit eats - %% all the memory within the first minute after startup then we - %% are out of luck. - ok = os_mon:call(memsup, - {set_check_interval, ?MEMSUP_CHECK_INTERVAL}, - infinity). + undefined -> if MemoryAlarms -> ok = start_memsup(), + ok = adjust_memsup_interval(); + true -> ok + end; + _ -> ok = adjust_memsup_interval() + end. stop() -> ok = alarm_handler:delete_alarm_handler(?MODULE). @@ -111,9 +74,15 @@ register(Pid, HighMemMFA) -> %%---------------------------------------------------------------------------- -init([]) -> - {ok, #alarms{alertees = dict:new()}}. +init([MemoryAlarms]) -> + {ok, #alarms{alertees = case MemoryAlarms of + true -> dict:new(); + false -> undefined + end}}. +handle_call({register, _Pid, _HighMemMFA}, + State = #alarms{alertees = undefined}) -> + {ok, ok, State}; handle_call({register, Pid, HighMemMFA}, State = #alarms{alertees = Alertess}) -> _MRef = erlang:monitor(process, Pid), @@ -139,6 +108,9 @@ handle_event({clear_alarm, system_memory_high_watermark}, State) -> handle_event(_Event, State) -> {ok, State}. +handle_info({'DOWN', _MRef, process, _Pid, _Reason}, + State = #alarms{alertees = undefined}) -> + {ok, State}; handle_info({'DOWN', _MRef, process, Pid, _Reason}, State = #alarms{alertees = Alertess}) -> {ok, State#alarms{alertees = dict:erase(Pid, Alertess)}}; @@ -154,6 +126,56 @@ code_change(_OldVsn, State, _Extra) -> %%---------------------------------------------------------------------------- +start_memsup() -> + Mod = case os:type() of + %% memsup doesn't take account of buffers or cache when + %% considering "free" memory - therefore on Linux we can + %% get memory alarms very easily without any pressure + %% existing on memory at all. Therefore we need to use + %% our own simple memory monitor. + %% + {unix, linux} -> rabbit_memsup_linux; + + %% Start memsup programmatically rather than via the + %% rabbitmq-server script. This is not quite the right + %% thing to do as os_mon checks to see if memsup is + %% available before starting it, but as memsup is + %% available everywhere (even on VXWorks) it should be + %% ok. + %% + %% One benefit of the programmatic startup is that we + %% can add our alarm_handler before memsup is running, + %% thus ensuring that we notice memory alarms that go + %% off on startup. + %% + _ -> memsup + end, + %% This is based on os_mon:childspec(memsup, true) + {ok, _} = supervisor:start_child( + os_mon_sup, + {memsup, {Mod, start_link, []}, + permanent, 2000, worker, [Mod]}), + ok. + +adjust_memsup_interval() -> + %% The default memsup check interval is 1 minute, which is way too + %% long - rabbit can gobble up all memory in a matter of seconds. + %% Unfortunately the memory_check_interval configuration parameter + %% and memsup:set_check_interval/1 function only provide a + %% granularity of minutes. So we have to peel off one layer of the + %% API to get to the underlying layer which operates at the + %% granularity of milliseconds. + %% + %% Note that the new setting will only take effect after the first + %% check has completed, i.e. after one minute. So if rabbit eats + %% all the memory within the first minute after startup then we + %% are out of luck. + ok = os_mon:call(memsup, + {set_check_interval, ?MEMSUP_CHECK_INTERVAL}, + infinity). + +alert(_Alert, undefined) -> + ok; alert(Alert, Alertees) -> dict:fold(fun (Pid, {M, F, A}, Acc) -> ok = erlang:apply(M, F, A ++ [Pid, Alert]), diff --git a/src/rabbit_amqqueue.erl b/src/rabbit_amqqueue.erl index d142507df3..24ded98cc0 100644 --- a/src/rabbit_amqqueue.erl +++ b/src/rabbit_amqqueue.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -27,8 +33,9 @@ -export([start/0, recover/0, declare/4, delete/3, purge/1, internal_delete/1]). -export([pseudo_queue/2]). --export([lookup/1, with/2, with_or_die/2, list_vhost_queues/1, +-export([lookup/1, with/2, with_or_die/2, stat/1, stat_all/0, deliver/5, redeliver/2, requeue/3, ack/4]). +-export([list/1, info/1, info/2, info_all/1, info_all/2]). -export([claim_queue/2]). -export([basic_get/3, basic_consume/8, basic_cancel/4]). -export([notify_sent/2]). @@ -55,6 +62,7 @@ -type(qfun(A) :: fun ((amqqueue()) -> A)). -type(ok_or_errors() :: 'ok' | {'error', [{'error' | 'exit' | 'throw', any()}]}). + -spec(start/0 :: () -> 'ok'). -spec(recover/0 :: () -> 'ok'). -spec(declare/4 :: (queue_name(), bool(), bool(), amqp_table()) -> @@ -62,7 +70,11 @@ -spec(lookup/1 :: (queue_name()) -> {'ok', amqqueue()} | not_found()). -spec(with/2 :: (queue_name(), qfun(A)) -> A | not_found()). -spec(with_or_die/2 :: (queue_name(), qfun(A)) -> A). --spec(list_vhost_queues/1 :: (vhost()) -> [amqqueue()]). +-spec(list/1 :: (vhost()) -> [amqqueue()]). +-spec(info/1 :: (amqqueue()) -> [info()]). +-spec(info/2 :: (amqqueue(), [info_key()]) -> [info()]). +-spec(info_all/1 :: (vhost()) -> [[info()]]). +-spec(info_all/2 :: (vhost(), [info_key()]) -> [[info()]]). -spec(stat/1 :: (amqqueue()) -> qstats()). -spec(stat_all/0 :: () -> [qstats()]). -spec(delete/3 :: @@ -180,10 +192,25 @@ with_or_die(Name, F) -> not_found, "no ~s", [rabbit_misc:rs(Name)]) end). -list_vhost_queues(VHostPath) -> +list(VHostPath) -> mnesia:dirty_match_object( #amqqueue{name = rabbit_misc:r(VHostPath, queue), _ = '_'}). +map(VHostPath, F) -> rabbit_misc:filter_exit_map(F, list(VHostPath)). + +info(#amqqueue{ pid = QPid }) -> + gen_server:call(QPid, info). + +info(#amqqueue{ pid = QPid }, Items) -> + case gen_server:call(QPid, {info, Items}) of + {ok, Res} -> Res; + {error, Error} -> throw(Error) + end. + +info_all(VHostPath) -> map(VHostPath, fun (Q) -> info(Q) end). + +info_all(VHostPath, Items) -> map(VHostPath, fun (Q) -> info(Q, Items) end). + stat(#amqqueue{pid = QPid}) -> gen_server:call(QPid, stat). stat_all() -> diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index 2000a11cbd..b2c619d3b8 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -63,6 +69,21 @@ is_overload_protection_active, unsent_message_count}). +-define(INFO_KEYS, + [name, + durable, + auto_delete, + arguments, + pid, + messages_ready, + messages_unacknowledged, + messages_uncommitted, + messages, + acks_uncommitted, + consumers, + transactions, + memory]). + %%---------------------------------------------------------------------------- start_link(Q) -> @@ -444,6 +465,9 @@ store_tx(Txn, Tx) -> erase_tx(Txn) -> erase({txn, Txn}). +all_tx_record() -> + [T || {{txn, _}, T} <- get()]. + all_tx() -> [Txn || {{txn, Txn}, _} <- get()]. @@ -495,8 +519,50 @@ purge_message_buffer(QName, MessageBuffer) -> %% artifically ack them. persist_acks(none, QName, lists:append(Messages)). +infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. + +i(name, #q{q = #amqqueue{name = Name}}) -> Name; +i(durable, #q{q = #amqqueue{durable = Durable}}) -> Durable; +i(auto_delete, #q{q = #amqqueue{auto_delete = AutoDelete}}) -> AutoDelete; +i(arguments, #q{q = #amqqueue{arguments = Arguments}}) -> Arguments; +i(pid, #q{q = #amqqueue{pid = Pid}}) -> Pid; +i(messages_ready, #q{message_buffer = MessageBuffer}) -> + queue:len(MessageBuffer); +i(messages_unacknowledged, _) -> + lists:sum([dict:size(UAM) || + #cr{unacked_messages = UAM} <- all_ch_record()]); +i(messages_uncommitted, _) -> + lists:sum([length(Pending) || + #tx{pending_messages = Pending} <- all_tx_record()]); +i(messages, State) -> + lists:sum([i(Item, State) || Item <- [messages_ready, + messages_unacknowledged, + messages_uncommitted]]); +i(acks_uncommitted, _) -> + lists:sum([length(Pending) || + #tx{pending_acks = Pending} <- all_tx_record()]); +i(consumers, _) -> + lists:sum([length(Consumers) || + #cr{consumers = Consumers} <- all_ch_record()]); +i(transactions, _) -> + length(all_tx_record()); +i(memory, _) -> + {memory, M} = process_info(self(), memory), + M; +i(Item, _) -> + throw({bad_argument, Item}). + %--------------------------------------------------------------------------- +handle_call(info, _From, State) -> + reply(infos(?INFO_KEYS, State), State); + +handle_call({info, Items}, _From, State) -> + try + reply({ok, infos(Items, State)}, State) + catch Error -> reply({error, Error}, State) + end; + handle_call({deliver_immediately, Txn, Message}, _From, State) -> %% Synchronous, "immediate" delivery mode %% diff --git a/src/rabbit_amqqueue_sup.erl b/src/rabbit_amqqueue_sup.erl index c68e2b3eda..46d23a4075 100644 --- a/src/rabbit_amqqueue_sup.erl +++ b/src/rabbit_amqqueue_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl index 8b16abec70..6cfa9e6d17 100644 --- a/src/rabbit_binary_generator.erl +++ b/src/rabbit_binary_generator.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_binary_parser.erl b/src/rabbit_binary_parser.erl index e942521504..4ef382aaf5 100644 --- a/src/rabbit_binary_parser.erl +++ b/src/rabbit_binary_parser.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index b17a2b066f..b77d26a0c8 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index b821fa0dfa..ecc285a57f 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -113,14 +119,39 @@ Available commands: list_user_vhosts <UserName> list_vhost_users <VHostPath> + list_queues [-p <VHostPath>] [<QueueInfoItem> ...] + list_exchanges [-p <VHostPath>] [<ExchangeInfoItem> ...] + list_bindings [-p <VHostPath>] + list_connections [<ConnectionInfoItem> ...] + Quiet output mode is selected with the \"-q\" flag. Informational messages are suppressed when quiet mode is in effect. -<node> should be the name of the master node of the RabbitMQ cluster. It -defaults to the node named \"rabbit\" on the local host. On a host named -\"server.example.com\", the master node will usually be rabbit@server (unless -NODENAME has been set to some non-default value at broker startup time). The -output of hostname -s is usually the correct suffix to use after the \"@\" sign. +<node> should be the name of the master node of the RabbitMQ +cluster. It defaults to the node named \"rabbit\" on the local +host. On a host named \"server.example.com\", the master node will +usually be rabbit@server (unless RABBITMQ_NODENAME has been set to +some non-default value at broker startup time). The output of hostname +-s is usually the correct suffix to use after the \"@\" sign. + +The list_queues, list_exchanges and list_bindings commands accept an optional +virtual host parameter for which to display results. The default value is \"/\". + +<QueueInfoItem> must be a member of the list [name, durable, auto_delete, +arguments, pid, messages_ready, messages_unacknowledged, messages_uncommitted, +messages, acks_uncommitted, consumers, transactions, memory]. The default is + to display name and (number of) messages. + +<ExchangeInfoItem> must be a member of the list [name, type, durable, +auto_delete, arguments]. The default is to display name and type. + +The output format for \"list_bindings\" is a list of rows containing +exchange name, routing key, queue name and arguments, in that order. + +<ConnectionInfoItem> must be a member of the list [pid, address, port, +peer_address, peer_port, state, channels, user, vhost, timeout, frame_max, +recv_oct, recv_cnt, send_oct, send_cnt, send_pend]. The default is to display +user, peer_address and peer_port. "), halt(1). @@ -206,7 +237,85 @@ action(list_user_vhosts, Node, Args = [_Username], Inform) -> action(list_vhost_users, Node, Args = [_VHostPath], Inform) -> Inform("Listing users for vhosts ~p", Args), - display_list(call(Node, {rabbit_access_control, list_vhost_users, Args})). + display_list(call(Node, {rabbit_access_control, list_vhost_users, Args})); + +action(list_queues, Node, Args, Inform) -> + Inform("Listing queues", []), + {VHostArg, RemainingArgs} = parse_vhost_flag(Args), + ArgAtoms = default_if_empty(RemainingArgs, [name, messages]), + display_info_list(rpc_call(Node, rabbit_amqqueue, info_all, + [VHostArg, ArgAtoms]), + ArgAtoms); + +action(list_exchanges, Node, Args, Inform) -> + Inform("Listing exchanges", []), + {VHostArg, RemainingArgs} = parse_vhost_flag(Args), + ArgAtoms = default_if_empty(RemainingArgs, [name, type]), + display_info_list(rpc_call(Node, rabbit_exchange, info_all, + [VHostArg, ArgAtoms]), + ArgAtoms); + +action(list_bindings, Node, Args, Inform) -> + Inform("Listing bindings", []), + {VHostArg, _} = parse_vhost_flag(Args), + InfoKeys = [exchange_name, routing_key, queue_name, args], + display_info_list( + [lists:zip(InfoKeys, tuple_to_list(X)) || + X <- rpc_call(Node, rabbit_exchange, list_bindings, [VHostArg])], + InfoKeys), + ok; + +action(list_connections, Node, Args, Inform) -> + Inform("Listing connections", []), + ArgAtoms = default_if_empty(Args, [user, peer_address, peer_port]), + display_info_list(rpc_call(Node, rabbit_networking, connection_info_all, + [ArgAtoms]), + ArgAtoms). + +parse_vhost_flag(Args) when is_list(Args) -> + case Args of + ["-p", VHost | RemainingArgs] -> + {list_to_binary(VHost), RemainingArgs}; + RemainingArgs -> + {<<"/">>, RemainingArgs} + end. + +default_if_empty(List, Default) when is_list(List) -> + if List == [] -> + Default; + true -> + [list_to_atom(X) || X <- List] + end. + +display_info_list(Results, InfoItemKeys) when is_list(Results) -> + lists:foreach( + fun (Result) -> + io:fwrite( + lists:flatten( + rabbit_misc:intersperse( + "\t", + [format_info_item(Result, X) || X <- InfoItemKeys]))), + io:nl() + end, + Results), + ok; + +display_info_list(Other, _) -> + Other. + +format_info_item(Items, Key) -> + {value, Info = {Key, Value}} = lists:keysearch(Key, 1, Items), + case Info of + {_, #resource{name = Name}} -> + url_encode(Name); + {Key, IpAddress} when Key =:= address; Key =:= peer_address + andalso is_tuple(IpAddress) -> + inet_parse:ntoa(IpAddress); + _ when is_binary(Value) -> + url_encode(Value); + _ -> + io_lib:format("~w", [Value]) + end. display_list(L) when is_list(L) -> lists:foreach(fun (I) -> @@ -221,3 +330,30 @@ call(Node, {Mod, Fun, Args}) -> rpc_call(Node, Mod, Fun, Args) -> rpc:call(Node, Mod, Fun, Args, ?RPC_TIMEOUT). + +%% url_encode is lifted from ibrowse, modified to preserve some characters +url_encode(Bin) when binary(Bin) -> + url_encode_char(lists:reverse(binary_to_list(Bin)), []). + +url_encode_char([X | T], Acc) when X >= $a, X =< $z -> + url_encode_char(T, [X | Acc]); +url_encode_char([X | T], Acc) when X >= $A, X =< $Z -> + url_encode_char(T, [X | Acc]); +url_encode_char([X | T], Acc) when X >= $0, X =< $9 -> + url_encode_char(T, [X | Acc]); +url_encode_char([X | T], Acc) + when X == $-; X == $_; X == $.; X == $~; + X == $!; X == $*; X == $'; X == $(; + X == $); X == $;; X == $:; X == $@; + X == $&; X == $=; X == $+; X == $$; + X == $,; X == $/; X == $?; X == $%; + X == $#; X == $[; X == $] -> + url_encode_char(T, [X | Acc]); +url_encode_char([X | T], Acc) -> + url_encode_char(T, [$%, d2h(X bsr 4), d2h(X band 16#0f) | Acc]); +url_encode_char([], Acc) -> + Acc. + +d2h(N) when N<10 -> N+$0; +d2h(N) -> N+$a-10. + diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl index 9220d7b46f..dc5824f1c9 100644 --- a/src/rabbit_error_logger.erl +++ b/src/rabbit_error_logger.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl index 7f7f77f5e1..9a9220b53e 100644 --- a/src/rabbit_error_logger_file_h.erl +++ b/src/rabbit_error_logger_file_h.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 58b8d7d60a..299747d141 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -29,10 +35,10 @@ -include("rabbit_framing.hrl"). -export([recover/0, declare/5, lookup/1, lookup_or_die/1, - list_vhost_exchanges/1, + list/1, info/1, info/2, info_all/1, info_all/2, simple_publish/6, simple_publish/3, route/2]). --export([add_binding/4, delete_binding/4]). +-export([add_binding/4, delete_binding/4, list_bindings/1]). -export([delete/2]). -export([delete_bindings_for_queue/1]). -export([check_type/1, assert_type/2, topic_matches/2]). @@ -62,7 +68,11 @@ -spec(assert_type/2 :: (exchange(), atom()) -> 'ok'). -spec(lookup/1 :: (exchange_name()) -> {'ok', exchange()} | not_found()). -spec(lookup_or_die/1 :: (exchange_name()) -> exchange()). --spec(list_vhost_exchanges/1 :: (vhost()) -> [exchange()]). +-spec(list/1 :: (vhost()) -> [exchange()]). +-spec(info/1 :: (exchange()) -> [info()]). +-spec(info/2 :: (exchange(), [info_key()]) -> [info()]). +-spec(info_all/1 :: (vhost()) -> [[info()]]). +-spec(info_all/2 :: (vhost(), [info_key()]) -> [[info()]]). -spec(simple_publish/6 :: (bool(), bool(), exchange_name(), routing_key(), binary(), binary()) -> publish_res()). @@ -74,6 +84,8 @@ -spec(delete_binding/4 :: (exchange_name(), queue_name(), routing_key(), amqp_table()) -> bind_res() | {'error', 'binding_not_found'}). +-spec(list_bindings/1 :: (vhost()) -> + [{exchange_name(), queue_name(), routing_key(), amqp_table()}]). -spec(delete_bindings_for_queue/1 :: (queue_name()) -> 'ok'). -spec(topic_matches/2 :: (binary(), binary()) -> bool()). -spec(delete/2 :: (exchange_name(), bool()) -> @@ -87,6 +99,8 @@ %%---------------------------------------------------------------------------- +-define(INFO_KEYS, [name, type, durable, auto_delete, arguments]. + recover() -> rabbit_misc:execute_mnesia_transaction( fun () -> @@ -154,10 +168,32 @@ lookup_or_die(Name) -> not_found, "no ~s", [rabbit_misc:rs(Name)]) end. -list_vhost_exchanges(VHostPath) -> +list(VHostPath) -> mnesia:dirty_match_object( #exchange{name = rabbit_misc:r(VHostPath, exchange), _ = '_'}). +map(VHostPath, F) -> + %% TODO: there is scope for optimisation here, e.g. using a + %% cursor, parallelising the function invocation + lists:map(F, list(VHostPath)). + +infos(Items, X) -> [{Item, i(Item, X)} || Item <- Items]. + +i(name, #exchange{name = Name}) -> Name; +i(type, #exchange{type = Type}) -> Type; +i(durable, #exchange{durable = Durable}) -> Durable; +i(auto_delete, #exchange{auto_delete = AutoDelete}) -> AutoDelete; +i(arguments, #exchange{arguments = Arguments}) -> Arguments; +i(Item, _) -> throw({bad_argument, Item}). + +info(X = #exchange{}) -> infos(?INFO_KEYS, X). + +info(X = #exchange{}, Items) -> infos(Items, X). + +info_all(VHostPath) -> map(VHostPath, fun (X) -> info(X) end). + +info_all(VHostPath, Items) -> map(VHostPath, fun (X) -> info(X, Items) end). + %% Usable by Erlang code that wants to publish messages. simple_publish(Mandatory, Immediate, ExchangeName, RoutingKeyBin, ContentTypeBin, BodyBin) -> @@ -336,6 +372,19 @@ sync_binding(ExchangeName, QueueName, RoutingKey, Arguments, Durable, Fun) -> R <- tuple_to_list(route_with_reverse(Binding))], ok. +list_bindings(VHostPath) -> + [{ExchangeName, QueueName, RoutingKey, Arguments} || + #route{binding = #binding{ + exchange_name = ExchangeName, + key = RoutingKey, + queue_name = QueueName, + args = Arguments}} + <- mnesia:dirty_match_object( + #route{binding = #binding{ + exchange_name = rabbit_misc:r(VHostPath, exchange), + _ = '_'}, + _ = '_'})]. + route_with_reverse(#route{binding = Binding}) -> route_with_reverse(Binding); route_with_reverse(Binding = #binding{}) -> diff --git a/src/rabbit_framing_channel.erl b/src/rabbit_framing_channel.erl index 76c0461399..060bed4893 100644 --- a/src/rabbit_framing_channel.erl +++ b/src/rabbit_framing_channel.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_heartbeat.erl b/src/rabbit_heartbeat.erl index b05a4655e5..0a68c9adad 100644 --- a/src/rabbit_heartbeat.erl +++ b/src/rabbit_heartbeat.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl index 8509eab8bd..d91893b0e8 100644 --- a/src/rabbit_limiter.erl +++ b/src/rabbit_limiter.erl @@ -1,5 +1,34 @@ -%% TODO Decide what to do with the license statement now that Cohesive have -%% bailed. +%% The contents of this file are subject to the Mozilla Public License +%% Version 1.1 (the "License"); you may not use this file except in +%% compliance with the License. You may obtain a copy of the License at +%% http://www.mozilla.org/MPL/ +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +%% License for the specific language governing rights and limitations +%% under the License. +%% +%% The Original Code is RabbitMQ. +%% +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. +%% +%% All Rights Reserved. +%% +%% Contributor(s): ______________________________________. +%% + -module(rabbit_limiter). -behaviour(gen_server). diff --git a/src/rabbit_load.erl b/src/rabbit_load.erl index 2154bf72ae..7bf85347fb 100644 --- a/src/rabbit_load.erl +++ b/src/rabbit_load.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_log.erl b/src/rabbit_log.erl index b4729230e6..f408336e94 100644 --- a/src/rabbit_log.erl +++ b/src/rabbit_log.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_memsup_linux.erl b/src/rabbit_memsup_linux.erl index b77ffcabb4..ffdc7e9946 100644 --- a/src/rabbit_memsup_linux.erl +++ b/src/rabbit_memsup_linux.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 6be73e43a1..973e163b7a 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -34,7 +40,7 @@ -export([dirty_read/1]). -export([r/3, r/2, rs/1]). -export([enable_cover/0, report_cover/0]). --export([throw_on_error/2, with_exit_handler/2]). +-export([throw_on_error/2, with_exit_handler/2, filter_exit_map/2]). -export([with_user/2, with_vhost/2, with_user_and_vhost/3]). -export([execute_mnesia_transaction/1]). -export([ensure_ok/2]). @@ -81,6 +87,7 @@ -spec(throw_on_error/2 :: (atom(), thunk({error, any()} | {ok, A} | A)) -> A). -spec(with_exit_handler/2 :: (thunk(A), thunk(A)) -> A). +-spec(filter_exit_map/2 :: (fun ((A) -> B), [A]) -> [B]). -spec(with_user/2 :: (username(), thunk(A)) -> A). -spec(with_vhost/2 :: (vhost(), thunk(A)) -> A). -spec(with_user_and_vhost/3 :: (username(), vhost(), thunk(A)) -> A). @@ -218,6 +225,13 @@ with_exit_handler(Handler, Thunk) -> Handler() end. +filter_exit_map(F, L) -> + Ref = make_ref(), + lists:filter(fun (R) -> R =/= Ref end, + [with_exit_handler( + fun () -> Ref end, + fun () -> F(I) end) || I <- L]). + with_user(Username, Thunk) -> fun () -> case mnesia:read({user, Username}) of diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index ca8b587846..d19c37cb44 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -30,9 +36,6 @@ -export([table_names/0]). -%% Called by rabbitmq-mnesia-current script --export([schema_current/0]). - %% create_tables/0 exported for helping embed RabbitMQ in or alongside %% other mnesia-using Erlang applications, such as ejabberd -export([create_tables/0]). @@ -51,7 +54,6 @@ -spec(reset/0 :: () -> 'ok'). -spec(force_reset/0 :: () -> 'ok'). -spec(create_tables/0 :: () -> 'ok'). --spec(schema_current/0 :: () -> bool()). -endif. @@ -95,20 +97,6 @@ cluster(ClusterNodes) -> reset() -> reset(false). force_reset() -> reset(true). -%% This is invoked by rabbitmq-mnesia-current. -schema_current() -> - application:start(mnesia), - ok = ensure_mnesia_running(), - ok = ensure_mnesia_dir(), - ok = init_db(read_cluster_nodes_config()), - try - ensure_schema_integrity(), - true - catch - {error, {schema_integrity_check_failed, _Reason}} -> - false - end. - %%-------------------------------------------------------------------- table_definitions() -> @@ -163,17 +151,12 @@ ensure_mnesia_not_running() -> yes -> throw({error, mnesia_unexpectedly_running}) end. -ensure_schema_integrity() -> - case catch lists:foreach(fun (Tab) -> - mnesia:table_info(Tab, version) - end, - table_names()) of - {'EXIT', Reason} -> throw({error, {schema_integrity_check_failed, - Reason}}); - _ -> ok - end, +check_schema_integrity() -> %%TODO: more thorough checks - ok. + case catch [mnesia:table_info(Tab, version) || Tab <- table_names()] of + {'EXIT', Reason} -> {error, Reason}; + _ -> ok + end. %% The cluster node config file contains some or all of the disk nodes %% that are members of the cluster this node is / should be a part of. @@ -253,7 +236,20 @@ init_db(ClusterNodes) -> case mnesia:change_config(extra_db_nodes, ClusterNodes -- [node()]) of {ok, []} -> if WasDiskNode and IsDiskNode -> - ok; + case check_schema_integrity() of + ok -> + ok; + {error, Reason} -> + %% NB: we cannot use rabbit_log here since + %% it may not have been started yet + error_logger:warning_msg( + "schema integrity check failed: ~p~n" ++ + "moving database to backup location " ++ + "and recreating schema from scratch~n", + [Reason]), + ok = move_db(), + ok = create_schema() + end; WasDiskNode -> throw({error, {cannot_convert_disk_node_to_ram_node, ClusterNodes}}); @@ -286,6 +282,28 @@ create_schema() -> cannot_start_mnesia), create_tables(). +move_db() -> + mnesia:stop(), + MnesiaDir = filename:dirname(mnesia:system_info(directory) ++ "/"), + {{Year, Month, Day}, {Hour, Minute, Second}} = erlang:universaltime(), + BackupDir = lists:flatten( + io_lib:format("~s_~w~2..0w~2..0w~2..0w~2..0w~2..0w", + [MnesiaDir, + Year, Month, Day, Hour, Minute, Second])), + case file:rename(MnesiaDir, BackupDir) of + ok -> + %% NB: we cannot use rabbit_log here since it may not have + %% been started yet + error_logger:warning_msg("moved database from ~s to ~s~n", + [MnesiaDir, BackupDir]), + ok; + {error, Reason} -> throw({error, {cannot_backup_mnesia, + MnesiaDir, BackupDir, Reason}}) + end, + ok = ensure_mnesia_dir(), + rabbit_misc:ensure_ok(mnesia:start(), cannot_start_mnesia), + ok. + create_tables() -> lists:foreach(fun ({Tab, TabArgs}) -> case mnesia:create_table(Tab, TabArgs) of @@ -347,13 +365,17 @@ create_local_table_copy(Tab, Type) -> ok. wait_for_tables() -> - ok = ensure_schema_integrity(), - case mnesia:wait_for_tables(table_names(), 30000) of - ok -> ok; - {timeout, BadTabs} -> - throw({error, {timeout_waiting_for_tables, BadTabs}}); + case check_schema_integrity() of + ok -> + case mnesia:wait_for_tables(table_names(), 30000) of + ok -> ok; + {timeout, BadTabs} -> + throw({error, {timeout_waiting_for_tables, BadTabs}}); + {error, Reason} -> + throw({error, {failed_waiting_for_tables, Reason}}) + end; {error, Reason} -> - throw({error, {failed_waiting_for_tables, Reason}}) + throw({error, {schema_integrity_check_failed, Reason}}) end. reset(Force) -> diff --git a/src/rabbit_multi.erl b/src/rabbit_multi.erl index b99dfbc1c1..7f6eaa8e93 100644 --- a/src/rabbit_multi.erl +++ b/src/rabbit_multi.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -84,8 +90,8 @@ action(start_all, [NodeCount], RpcTimeout) -> io:format("Starting all nodes...~n", []), N = list_to_integer(NodeCount), {NodePids, Running} = start_nodes(N, N, [], true, - getenv("NODENAME"), - getenv("NODE_PORT"), + getenv("RABBITMQ_NODENAME"), + getenv("RABBITMQ_NODE_PORT"), RpcTimeout), write_pids_file(NodePids), case Running of @@ -155,8 +161,8 @@ start_nodes(N, Total, PNodePid, Running, NodeNameBase, NodePortBase, RpcTimeout). start_node(NodeName, NodePort, RpcTimeout) -> - os:putenv("NODENAME", NodeName), - os:putenv("NODE_PORT", integer_to_list(NodePort)), + os:putenv("RABBITMQ_NODENAME", NodeName), + os:putenv("RABBITMQ_NODE_PORT", integer_to_list(NodePort)), Node = rabbit_misc:localnode(list_to_atom(NodeName)), io:format("Starting node ~s...~n", [Node]), case rpc:call(Node, os, getpid, []) of @@ -213,13 +219,13 @@ with_os(Handlers) -> end. script_filename() -> - ScriptHome = getenv("SCRIPT_HOME"), + ScriptHome = getenv("RABBITMQ_SCRIPT_HOME"), ScriptName = with_os( [{unix , fun () -> "rabbitmq-server" end}, {win32, fun () -> "rabbitmq-server.bat" end}]), ScriptHome ++ "/" ++ ScriptName ++ " -noinput". -pids_file() -> getenv("PIDS_FILE"). +pids_file() -> getenv("RABBITMQ_PIDS_FILE"). write_pids_file(Pids) -> FileName = pids_file(), diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index a91602abb2..99ea37d884 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -26,7 +32,9 @@ -module(rabbit_networking). -export([start/0, start_tcp_listener/2, stop_tcp_listener/2, - on_node_down/1, active_listeners/0, node_listeners/1]). + on_node_down/1, active_listeners/0, node_listeners/1, + connections/0, connection_info/1, connection_info/2, + connection_info_all/0, connection_info_all/1]). %%used by TCP-based transports, e.g. STOMP adapter -export([check_tcp_listener_address/3]). @@ -40,12 +48,18 @@ -ifdef(use_specs). -type(host() :: ip_address() | string() | atom()). +-type(connection() :: pid()). -spec(start/0 :: () -> 'ok'). -spec(start_tcp_listener/2 :: (host(), ip_port()) -> 'ok'). -spec(stop_tcp_listener/2 :: (host(), ip_port()) -> 'ok'). -spec(active_listeners/0 :: () -> [listener()]). -spec(node_listeners/1 :: (erlang_node()) -> [listener()]). +-spec(connections/0 :: () -> [connection()]). +-spec(connection_info/1 :: (connection()) -> [info()]). +-spec(connection_info/2 :: (connection(), [info_key()]) -> [info()]). +-spec(connection_info_all/0 :: () -> [[info()]]). +-spec(connection_info_all/1 :: ([info_key()]) -> [[info()]]). -spec(on_node_down/1 :: (erlang_node()) -> 'ok'). -spec(check_tcp_listener_address/3 :: (atom(), host(), ip_port()) -> {ip_address(), atom()}). @@ -136,6 +150,16 @@ start_client(Sock) -> Child ! {go, Sock}, Child. +connections() -> + [Pid || {_, Pid, _, _} <- supervisor:which_children( + rabbit_tcp_client_sup)]. + +connection_info(Pid) -> rabbit_reader:info(Pid). +connection_info(Pid, Items) -> rabbit_reader:info(Pid, Items). + +connection_info_all() -> cmap(fun (Q) -> connection_info(Q) end). +connection_info_all(Items) -> cmap(fun (Q) -> connection_info(Q, Items) end). + %%-------------------------------------------------------------------- tcp_host({0,0,0,0}) -> @@ -149,3 +173,5 @@ tcp_host(IPAddress) -> {ok, #hostent{h_name = Name}} -> Name; {error, _Reason} -> inet_parse:ntoa(IPAddress) end. + +cmap(F) -> rabbit_misc:filter_exit_map(F, connections()). diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl index 2fb582a9b9..14a69a472e 100644 --- a/src/rabbit_node_monitor.erl +++ b/src/rabbit_node_monitor.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_persister.erl b/src/rabbit_persister.erl index 91016d9d63..c34ad85100 100644 --- a/src/rabbit_persister.erl +++ b/src/rabbit_persister.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index ce26c11a0b..3f8d7cac5f 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -27,7 +33,7 @@ -include("rabbit_framing.hrl"). -include("rabbit.hrl"). --export([start_link/0]). +-export([start_link/0, info/1, info/2]). -export([system_continue/3, system_terminate/4, system_code_change/4]). @@ -50,6 +56,11 @@ -record(v1, {sock, connection, callback, recv_ref, connection_state}). +-define(INFO_KEYS, + [pid, address, port, peer_address, peer_port, + recv_oct, recv_cnt, send_oct, send_cnt, send_pend, + state, channels, user, vhost, timeout, frame_max]). + %% connection lifecycle %% %% all state transitions and terminations are marked with *...* @@ -120,6 +131,15 @@ %% %% TODO: refactor the code so that the above is obvious +%%---------------------------------------------------------------------------- + +-ifdef(use_specs). + +-spec(info/1 :: (pid()) -> [info()]). +-spec(info/2 :: (pid(), [info_key()]) -> [info()]). + +-endif. + %%-------------------------------------------------------------------------- start_link() -> @@ -140,6 +160,15 @@ system_terminate(Reason, _Parent, _Deb, _State) -> system_code_change(Misc, _Module, _OldVsn, _Extra) -> {ok, Misc}. +info(Pid) -> + gen_server:call(Pid, info). + +info(Pid, Items) -> + case gen_server:call(Pid, {info, Items}) of + {ok, Res} -> Res; + {error, Error} -> throw(Error) + end. + setup_profiling() -> Value = rabbit_misc:get_config(profiling_enabled, false), case Value of @@ -270,6 +299,14 @@ mainloop(Parent, Deb, State = #v1{sock= Sock, recv_ref = Ref}) -> end; timeout -> throw({timeout, State#v1.connection_state}); + {'$gen_call', From, info} -> + gen_server:reply(From, infos(?INFO_KEYS, State)), + mainloop(Parent, Deb, State); + {'$gen_call', From, {info, Items}} -> + gen_server:reply(From, try {ok, infos(Items, State)} + catch Error -> {error, Error} + end), + mainloop(Parent, Deb, State); {system, From, Request} -> sys:handle_system_msg(Request, From, Parent, ?MODULE, Deb, State); @@ -617,6 +654,51 @@ compute_redirects(false) -> %%-------------------------------------------------------------------------- +infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. + +i(pid, #v1{}) -> + self(); +i(address, #v1{sock = Sock}) -> + {ok, {A, _}} = inet:sockname(Sock), + A; +i(port, #v1{sock = Sock}) -> + {ok, {_, P}} = inet:sockname(Sock), + P; +i(peer_address, #v1{sock = Sock}) -> + {ok, {A, _}} = inet:peername(Sock), + A; +i(peer_port, #v1{sock = Sock}) -> + {ok, {_, P}} = inet:peername(Sock), + P; +i(SockStat, #v1{sock = Sock}) when SockStat =:= recv_oct; + SockStat =:= recv_cnt; + SockStat =:= send_oct; + SockStat =:= send_cnt; + SockStat =:= send_pend -> + case inet:getstat(Sock, [SockStat]) of + {ok, [{SockStat, StatVal}]} -> StatVal; + {error, einval} -> undefined; + {error, Error} -> throw({cannot_get_socket_stats, Error}) + end; +i(state, #v1{connection_state = S}) -> + S; +i(channels, #v1{}) -> + length(all_channels()); +i(user, #v1{connection = #connection{user = #user{username = Username}}}) -> + Username; +i(user, #v1{connection = #connection{user = none}}) -> + none; +i(vhost, #v1{connection = #connection{vhost = VHost}}) -> + VHost; +i(timeout, #v1{connection = #connection{timeout_sec = Timeout}}) -> + Timeout; +i(frame_max, #v1{connection = #connection{frame_max = FrameMax}}) -> + FrameMax; +i(Item, #v1{}) -> + throw({bad_argument, Item}). + +%%-------------------------------------------------------------------------- + send_to_new_channel(Channel, AnalyzedFrame, State) -> case get({closing_channel, Channel}) of undefined -> diff --git a/src/rabbit_router.erl b/src/rabbit_router.erl index 58eb5b54f6..ad653a2f2a 100644 --- a/src/rabbit_router.erl +++ b/src/rabbit_router.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl index e2385d83ba..9e4c9c8a31 100644 --- a/src/rabbit_sasl_report_file_h.erl +++ b/src/rabbit_sasl_report_file_h.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_sup.erl b/src/rabbit_sup.erl index ea55869004..730d7909bc 100644 --- a/src/rabbit_sup.erl +++ b/src/rabbit_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl index d7c8bddf03..df2e71d9e6 100644 --- a/src/rabbit_tests.erl +++ b/src/rabbit_tests.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% @@ -29,6 +35,7 @@ -import(lists). +-include("rabbit.hrl"). -include_lib("kernel/include/file.hrl"). test_content_prop_roundtrip(Datum, Binary) -> @@ -45,6 +52,7 @@ all_tests() -> passed = test_log_management_during_startup(), passed = test_cluster_management(), passed = test_user_management(), + passed = test_server_status(), passed. test_parsing() -> @@ -131,8 +139,6 @@ test_topic_matching() -> passed. test_app_management() -> - true = rabbit_mnesia:schema_current(), - %% starting, stopping, status ok = control_action(stop_app, []), ok = control_action(stop_app, []), @@ -488,12 +494,57 @@ test_user_management() -> passed. +test_server_status() -> + + %% create a queue so we have something to list + Q = #amqqueue{} = rabbit_amqqueue:declare( + rabbit_misc:r(<<"/">>, queue, <<"foo">>), + false, false, []), + + %% list queues + ok = info_action( + list_queues, + [name, durable, auto_delete, arguments, pid, + messages_ready, messages_unacknowledged, messages_uncommitted, + messages, acks_uncommitted, consumers, transactions, memory], + true), + + %% list exchanges + ok = info_action( + list_exchanges, + [name, type, durable, auto_delete, arguments], + true), + + %% list bindings + ok = control_action(list_bindings, []), + + %% cleanup + {ok, _} = rabbit_amqqueue:delete(Q, false, false), + + %% list connections + [#listener{host = H, port = P} | _] = rabbit_networking:active_listeners(), + {ok, C} = gen_tcp:connect(H, P, []), + timer:sleep(100), + ok = info_action( + list_connections, + [pid, address, port, peer_address, peer_port, state, + channels, user, vhost, timeout, frame_max, + recv_oct, recv_cnt, send_oct, send_cnt, send_pend], + false), + ok = gen_tcp:close(C), + + passed. + %--------------------------------------------------------------------- control_action(Command, Args) -> control_action(Command, node(), Args). control_action(Command, Node, Args) -> - case catch rabbit_control:action(Command, Node, Args, fun io:format/2) of + case catch rabbit_control:action( + Command, Node, Args, + fun (Format, Args1) -> + io:format(Format ++ " ...~n", Args1) + end) of ok -> io:format("done.~n"), ok; @@ -502,6 +553,15 @@ control_action(Command, Node, Args) -> Other end. +info_action(Command, Args, CheckVHost) -> + ok = control_action(Command, []), + if CheckVHost -> ok = control_action(Command, ["-p", "/"]); + true -> ok + end, + ok = control_action(Command, lists:map(fun atom_to_list/1, Args)), + {bad_argument, dummy} = control_action(Command, ["dummy"]), + ok. + empty_files(Files) -> [case file:read_file_info(File) of {ok, FInfo} -> FInfo#file_info.size == 0; diff --git a/src/rabbit_tracer.erl b/src/rabbit_tracer.erl index 5365b8732f..0c023f2aab 100644 --- a/src/rabbit_tracer.erl +++ b/src/rabbit_tracer.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl index a2688625be..9cf9f8aef9 100644 --- a/src/rabbit_writer.erl +++ b/src/rabbit_writer.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_acceptor.erl b/src/tcp_acceptor.erl index 3e4c5ee423..aa8b8ad5a7 100644 --- a/src/tcp_acceptor.erl +++ b/src/tcp_acceptor.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_acceptor_sup.erl b/src/tcp_acceptor_sup.erl index a3144e410c..f2bad5bc2e 100644 --- a/src/tcp_acceptor_sup.erl +++ b/src/tcp_acceptor_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_client_sup.erl b/src/tcp_client_sup.erl index 4e1b9c6b30..d92066a6c3 100644 --- a/src/tcp_client_sup.erl +++ b/src/tcp_client_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_listener.erl b/src/tcp_listener.erl index dc38b5941c..92a47cf127 100644 --- a/src/tcp_listener.erl +++ b/src/tcp_listener.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% diff --git a/src/tcp_listener_sup.erl b/src/tcp_listener_sup.erl index 9347240668..901a0da3b7 100644 --- a/src/tcp_listener_sup.erl +++ b/src/tcp_listener_sup.erl @@ -10,13 +10,19 @@ %% %% The Original Code is RabbitMQ. %% -%% The Initial Developers of the Original Code are LShift Ltd., -%% Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd. +%% The Initial Developers of the Original Code are LShift Ltd, +%% Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd. %% -%% Portions created by LShift Ltd., Cohesive Financial Technologies -%% LLC., and Rabbit Technologies Ltd. are Copyright (C) 2007-2008 -%% LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit -%% Technologies Ltd.; +%% Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd, +%% Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd +%% are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial +%% Technologies LLC, and Rabbit Technologies Ltd. +%% +%% Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift +%% Ltd. Portions created by Cohesive Financial Technologies LLC are +%% Copyright (C) 2007-2009 Cohesive Financial Technologies +%% LLC. Portions created by Rabbit Technologies Ltd are Copyright +%% (C) 2007-2009 Rabbit Technologies Ltd. %% %% All Rights Reserved. %% |
