summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2017-09-11 22:40:26 -0400
committerMichael Klishin <michael@clojurewerkz.org>2017-09-11 22:40:26 -0400
commit10ad5468a345a7ea0dace97b147da7cbba6bbcce (patch)
tree53945cf22762cb06911808b73b4eaf9e99fc05ea
parent52ab32e5fb9c4465091a9b6e7305f66942607687 (diff)
parent0527df37562453b20227ebafd2b49770f1f26eb4 (diff)
downloadrabbitmq-server-git-10ad5468a345a7ea0dace97b147da7cbba6bbcce.tar.gz
Merge branch 'stable'
Conflicts: src/rabbit_direct.erl
-rw-r--r--src/rabbit_direct.erl43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl
index 26e8f4d452..074eed1f9a 100644
--- a/src/rabbit_direct.erl
+++ b/src/rabbit_direct.erl
@@ -86,26 +86,31 @@ connect(Creds, VHost, Protocol, Pid, Infos) ->
AuthFun = auth_fun(Creds, VHost, ExtraAuthProps),
case rabbit:is_running() of
true ->
- case is_over_connection_limit(VHost, Creds, Pid) of
- true ->
- {error, not_allowed};
- false ->
- case is_vhost_alive(VHost, Creds, Pid) of
- false ->
- {error, {internal_error, vhost_is_down}};
+ case whereis(rabbit_direct_client_sup) of
+ undefined ->
+ {error, broker_is_booting};
+ _ ->
+ case is_over_connection_limit(VHost, Creds, Pid) of
true ->
- case AuthFun() of
- {ok, User = #user{username = Username}} ->
- notify_auth_result(Username,
- user_authentication_success, []),
- connect1(User, VHost, Protocol, Pid, Infos);
- {refused, Username, Msg, Args} ->
- notify_auth_result(Username,
- user_authentication_failure,
- [{error, rabbit_misc:format(Msg, Args)}]),
- {error, {auth_failure, "Refused"}}
- end
- end
+ {error, not_allowed};
+ false ->
+ case is_vhost_alive(VHost, Creds, Pid) of
+ false ->
+ {error, {internal_error, vhost_is_down}};
+ true ->
+ case AuthFun() of
+ {ok, User = #user{username = Username}} ->
+ notify_auth_result(Username,
+ user_authentication_success, []),
+ connect1(User, VHost, Protocol, Pid, Infos);
+ {refused, Username, Msg, Args} ->
+ notify_auth_result(Username,
+ user_authentication_failure,
+ [{error, rabbit_misc:format(Msg, Args)}]),
+ {error, {auth_failure, "Refused"}}
+ end %% AuthFun()
+ end %% is_vhost_alive
+ end %% is_over_connection_limit
end;
false -> {error, broker_not_found_on_node}
end.