summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2011-04-15 14:08:32 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2011-04-15 14:08:32 +0100
commita93cf2f3d63e87c3111192ceac35eb00e3eed4ba (patch)
treee8ac9055e123424f814869fa10fa3af4b1a09973 /src
parent5de4fa2dcc259e068bf5d3767044fd77f9c44f80 (diff)
parentea7f63fddad0acfff826c971a303c3e9293f0aec (diff)
downloadrabbitmq-server-git-a93cf2f3d63e87c3111192ceac35eb00e3eed4ba.tar.gz
Merging bug24050 to default
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_direct.erl15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl
index 0810c762c6..0dac18d1fe 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).