diff options
author | Rob Harrop <rob@rabbitmq.com> | 2011-04-15 15:16:27 +0100 |
---|---|---|
committer | Rob Harrop <rob@rabbitmq.com> | 2011-04-15 15:16:27 +0100 |
commit | fbeb31e26c921eca912839c9fced2aa4f724bd64 (patch) | |
tree | dd4d3976f7469cedc8a9c0b45faf83f4e01af317 | |
parent | c8afacc0308d8a0ffb4741bef3eb695622aff4b1 (diff) | |
parent | e39c17dcc4b5db692c064ec091c68510c3fb1bc8 (diff) | |
download | rabbitmq-server-bug24037.tar.gz |
Merge defaultbug24037
-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). |