summaryrefslogtreecommitdiff
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
commite39c17dcc4b5db692c064ec091c68510c3fb1bc8 (patch)
treee8ac9055e123424f814869fa10fa3af4b1a09973
parentafa173d431ecc420a20c712cb37f7bee4591124f (diff)
parenteffab8c369e7427883687f367871befb86422b71 (diff)
downloadrabbitmq-server-e39c17dcc4b5db692c064ec091c68510c3fb1bc8.tar.gz
Merging bug24050 to default
-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 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).