summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Alexandru Ionescu <vlad@rabbitmq.com>2011-01-20 17:19:07 +0000
committerVlad Alexandru Ionescu <vlad@rabbitmq.com>2011-01-20 17:19:07 +0000
commit1cc1ac6dc8c43a7d6fc6e36abb80cecd3a74414c (patch)
tree98d3c2fe536dfcb1a0064dd15f69c92972b794ea
parentf8ddf02f3d43445ba57ed290ff5b9f1df2b499b4 (diff)
downloadrabbitmq-server-1cc1ac6dc8c43a7d6fc6e36abb80cecd3a74414c.tar.gz
fixing type specs; other cosmetic
-rw-r--r--src/rabbit_channel_sup.erl17
-rw-r--r--src/rabbit_channel_sup_sup.erl9
-rw-r--r--src/rabbit_direct.erl60
-rw-r--r--src/rabbit_reader.erl4
4 files changed, 45 insertions, 45 deletions
diff --git a/src/rabbit_channel_sup.erl b/src/rabbit_channel_sup.erl
index 3b00181b..d21cfdb7 100644
--- a/src/rabbit_channel_sup.erl
+++ b/src/rabbit_channel_sup.erl
@@ -18,7 +18,7 @@
-behaviour(supervisor2).
--export([start_link/2]).
+-export([start_link/1]).
-export([init/1]).
@@ -31,19 +31,20 @@
-export_type([start_link_args/0]).
-type(start_link_args() ::
- {rabbit_types:protocol(), rabbit_net:socket(),
+ {'tcp', rabbit_types:protocol(), rabbit_net:socket(),
rabbit_channel:channel_number(), non_neg_integer(), pid(),
- rabbit_types:user(), rabbit_types:vhost(), pid()}).
+ rabbit_types:user(), rabbit_types:vhost(), pid()} |
+ {'direct', rabbit_channel:channel_number(), pid(), rabbit_types:user(),
+ rabbit_types:vhost(), pid()}).
--spec(start_link/2 :: (atom(), start_link_args()) ->
- {'ok', pid(), {pid(), any()}}).
+-spec(start_link/1 :: (start_link_args()) -> {'ok', pid(), {pid(), any()}}).
-endif.
%%----------------------------------------------------------------------------
-start_link(tcp, {Protocol, Sock, Channel, FrameMax, ReaderPid, User, VHost,
- Collector}) ->
+start_link({tcp, Protocol, Sock, Channel, FrameMax, ReaderPid, User, VHost,
+ Collector}) ->
{ok, SupPid} = supervisor2:start_link(?MODULE, []),
{ok, WriterPid} =
supervisor2:start_child(
@@ -60,7 +61,7 @@ start_link(tcp, {Protocol, Sock, Channel, FrameMax, ReaderPid, User, VHost,
intrinsic, ?MAX_WAIT, worker, [rabbit_channel]}),
{ok, AState} = rabbit_command_assembler:init(Protocol),
{ok, SupPid, {ChannelPid, AState}};
-start_link(direct, {Channel, ClientChannelPid, User, VHost, Collector}) ->
+start_link({direct, Channel, ClientChannelPid, User, VHost, Collector}) ->
{ok, SupPid} = supervisor2:start_link(?MODULE, []),
{ok, ChannelPid} =
supervisor2:start_child(
diff --git a/src/rabbit_channel_sup_sup.erl b/src/rabbit_channel_sup_sup.erl
index 9240ee37..8a65cfb0 100644
--- a/src/rabbit_channel_sup_sup.erl
+++ b/src/rabbit_channel_sup_sup.erl
@@ -18,7 +18,7 @@
-behaviour(supervisor2).
--export([start_link/0, start_channel/3]).
+-export([start_link/0, start_channel/2]).
-export([init/1]).
@@ -27,8 +27,7 @@
-ifdef(use_specs).
-spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
--spec(start_channel/3 :: (pid(), atom(),
- rabbit_channel_sup:start_link_args()) ->
+-spec(start_channel/2 :: (pid(), rabbit_channel_sup:start_link_args()) ->
{'ok', pid(), {pid(), any()}}).
-endif.
@@ -38,8 +37,8 @@
start_link() ->
supervisor2:start_link(?MODULE, []).
-start_channel(Pid, Type, Args) ->
- supervisor2:start_child(Pid, [Type, Args]).
+start_channel(Pid, Args) ->
+ supervisor2:start_child(Pid, [Args]).
%%----------------------------------------------------------------------------
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl
index b1c5f415..6b829abf 100644
--- a/src/rabbit_direct.erl
+++ b/src/rabbit_direct.erl
@@ -1,37 +1,35 @@
-%% 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/
+%% 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.
+%% 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 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-2010 LShift
-%% Ltd. Portions created by Cohesive Financial Technologies LLC are
-%% Copyright (C) 2007-2010 Cohesive Financial Technologies
-%% LLC. Portions created by Rabbit Technologies Ltd are Copyright
-%% (C) 2007-2010 Rabbit Technologies Ltd.
-%%
-%% All Rights Reserved.
-%%
-%% Contributor(s): ______________________________________.
+%% The Initial Developer of the Original Code is VMware, Inc.
+%% Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
%%
-module(rabbit_direct).
--export([boot/0, start_channel/1]).
+-export([boot/0, start_channel/5]).
+
+-include("rabbit.hrl").
+
+%%----------------------------------------------------------------------------
+
+-ifdef(use_specs).
+
+-spec(boot/0 :: () -> 'ok').
+-spec(start_channel/5 :: (rabbit_channel:channel_number(), pid(),
+ rabbit_types:user(), rabbit_types:vhost(), pid()) ->
+ {'ok', pid()}).
+
+-endif.
%%----------------------------------------------------------------------------
@@ -42,11 +40,13 @@ boot() ->
{rabbit_direct_client_sup,
{rabbit_client_sup, start_link,
[{local, rabbit_direct_client_sup},
- {rabbit_channel_sup, start_link, [direct]}]},
+ {rabbit_channel_sup, start_link, []}]},
transient, infinity, supervisor, [rabbit_client_sup]}),
ok.
-start_channel(Args) ->
+start_channel(Number, ClientChannelPid, User, VHost, Collector) ->
{ok, _, {ChannelPid, _}} =
- supervisor2:start_child(rabbit_direct_client_sup, [Args]),
+ supervisor2:start_child(
+ rabbit_direct_client_sup,
+ [{direct, Number, ClientChannelPid, User, VHost, Collector}]),
{ok, ChannelPid}.
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index c2245a13..f8114d86 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -940,8 +940,8 @@ send_to_new_channel(Channel, AnalyzedFrame, State) ->
vhost = VHost}} = State,
{ok, _ChSupPid, {ChPid, AState}} =
rabbit_channel_sup_sup:start_channel(
- ChanSupSup, tcp, {Protocol, Sock, Channel, FrameMax,
- self(), User, VHost, Collector}),
+ ChanSupSup, {tcp, Protocol, Sock, Channel, FrameMax, self(), User,
+ VHost, Collector}),
erlang:monitor(process, ChPid),
NewAState = process_channel_frame(AnalyzedFrame, self(),
Channel, ChPid, AState),