diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2011-04-15 14:08:32 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2011-04-15 14:08:32 +0100 |
commit | e39c17dcc4b5db692c064ec091c68510c3fb1bc8 (patch) | |
tree | e8ac9055e123424f814869fa10fa3af4b1a09973 | |
parent | afa173d431ecc420a20c712cb37f7bee4591124f (diff) | |
parent | effab8c369e7427883687f367871befb86422b71 (diff) | |
download | rabbitmq-server-e39c17dcc4b5db692c064ec091c68510c3fb1bc8.tar.gz |
Merging bug24050 to default
-rw-r--r-- | src/rabbit_direct.erl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl index 0810c762..0dac18d1 100644 --- a/src/rabbit_direct.erl +++ b/src/rabbit_direct.erl @@ -16,7 +16,7 @@ -module(rabbit_direct). --export([boot/0, connect/4, start_channel/8]). +-export([boot/0, connect/5, start_channel/8, disconnect/1]). -include("rabbit.hrl"). @@ -25,7 +25,8 @@ -ifdef(use_specs). -spec(boot/0 :: () -> 'ok'). --spec(connect/4 :: (binary(), binary(), binary(), rabbit_types:protocol()) -> +-spec(connect/5 :: (binary(), binary(), binary(), rabbit_types:protocol(), + rabbit_event:event_props()) -> {'ok', {rabbit_types:user(), rabbit_framing:amqp_table()}}). -spec(start_channel/8 :: @@ -33,6 +34,8 @@ rabbit_types:user(), rabbit_types:vhost(), rabbit_framing:amqp_table(), pid()) -> {'ok', pid()}). +-spec(disconnect/1 :: (rabbit_event:event_props()) -> 'ok'). + -endif. %%---------------------------------------------------------------------------- @@ -50,13 +53,14 @@ boot() -> %%---------------------------------------------------------------------------- -connect(Username, Password, VHost, Protocol) -> +connect(Username, Password, VHost, Protocol, Infos) -> case lists:keymember(rabbit, 1, application:which_applications()) of true -> try rabbit_access_control:user_pass_login(Username, Password) of #user{} = User -> try rabbit_access_control:check_vhost_access(User, VHost) of - ok -> {ok, {User, + ok -> rabbit_event:notify(connection_created, Infos), + {ok, {User, rabbit_reader:server_properties(Protocol)}} catch exit:#amqp_error{name = access_refused} -> @@ -77,3 +81,6 @@ start_channel(Number, ClientChannelPid, ConnPid, Protocol, User, VHost, [{direct, Number, ClientChannelPid, ConnPid, Protocol, User, VHost, Capabilities, Collector}]), {ok, ChannelPid}. + +disconnect(Infos) -> + rabbit_event:notify(connection_closed, Infos). |