@@ -86,26 +86,31 @@ connect(Creds, VHost, Protocol, Pid, Infos) ->
8686 AuthFun = auth_fun (Creds , VHost , ExtraAuthProps ),
8787 case rabbit :is_running () of
8888 true ->
89- case is_over_connection_limit (VHost , Creds , Pid ) of
90- true ->
91- {error , not_allowed };
92- false ->
93- case is_vhost_alive (VHost , Creds , Pid ) of
94- false ->
95- {error , {internal_error , vhost_is_down }};
89+ case whereis (rabbit_direct_client_sup ) of
90+ undefined ->
91+ {error , broker_is_booting };
92+ _ ->
93+ case is_over_connection_limit (VHost , Creds , Pid ) of
9694 true ->
97- case AuthFun () of
98- {ok , User = # user {username = Username }} ->
99- notify_auth_result (Username ,
100- user_authentication_success , []),
101- connect1 (User , VHost , Protocol , Pid , Infos );
102- {refused , Username , Msg , Args } ->
103- notify_auth_result (Username ,
104- user_authentication_failure ,
105- [{error , rabbit_misc :format (Msg , Args )}]),
106- {error , {auth_failure , " Refused" }}
107- end
108- end
95+ {error , not_allowed };
96+ false ->
97+ case is_vhost_alive (VHost , Creds , Pid ) of
98+ false ->
99+ {error , {internal_error , vhost_is_down }};
100+ true ->
101+ case AuthFun () of
102+ {ok , User = # user {username = Username }} ->
103+ notify_auth_result (Username ,
104+ user_authentication_success , []),
105+ connect1 (User , VHost , Protocol , Pid , Infos );
106+ {refused , Username , Msg , Args } ->
107+ notify_auth_result (Username ,
108+ user_authentication_failure ,
109+ [{error , rabbit_misc :format (Msg , Args )}]),
110+ {error , {auth_failure , " Refused" }}
111+ end % % AuthFun()
112+ end % % is_vhost_alive
113+ end % % is_over_connection_limit
109114 end ;
110115 false -> {error , broker_not_found_on_node }
111116 end .
0 commit comments