Should not exit arbitrarily if clientid conflicts in mnesia
This commit is contained in:
parent
d9500412bf
commit
d2a4e2c615
|
@ -213,7 +213,7 @@ process(?CONNECT_PACKET(Var), State0) ->
|
|||
%% ACCEPT
|
||||
{?CONNACK_ACCEPT, SP, State2#proto_state{session = Session, is_superuser = IsSuperuser}};
|
||||
{error, Error} ->
|
||||
exit({shutdown, Error})
|
||||
{stop, {shutdown, Error}, State2}
|
||||
end;
|
||||
{error, Reason}->
|
||||
?LOG(error, "Username '~s' login failed for ~p", [Username, Reason], State1),
|
||||
|
@ -381,12 +381,12 @@ stop_if_auth_failure(_RC, State) ->
|
|||
|
||||
shutdown(_Error, #proto_state{client_id = undefined}) ->
|
||||
ignore;
|
||||
|
||||
shutdown(conflict, #proto_state{client_id = _ClientId}) ->
|
||||
shutdown(conflict, _State) ->
|
||||
%% let it down
|
||||
ignore;
|
||||
shutdown(mnesia_conflict, _State) ->
|
||||
%% let it down
|
||||
%% emqttd_cm:unreg(ClientId);
|
||||
ignore;
|
||||
|
||||
shutdown(Error, State = #proto_state{will_msg = WillMsg}) ->
|
||||
?LOG(debug, "Shutdown for ~p", [Error], State),
|
||||
Client = client(State),
|
||||
|
|
|
@ -216,8 +216,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
create_session({CleanSess, {ClientId, Username}, ClientPid}, State) ->
|
||||
case create_session(CleanSess, {ClientId, Username}, ClientPid) of
|
||||
{ok, SessPid} ->
|
||||
{reply, {ok, SessPid, false},
|
||||
monitor_session(ClientId, SessPid, State)};
|
||||
{reply, {ok, SessPid, false}, monitor_session(ClientId, SessPid, State)};
|
||||
{error, Error} ->
|
||||
{reply, {error, Error}, State}
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue