25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-17 15:29:23 +02:00

fixes annoying crash with controller change

This commit is contained in:
Evgeniy Khramtsov 2010-10-08 19:26:49 +10:00
parent f81473fc65
commit 350af319bf
2 changed files with 19 additions and 4 deletions

View File

@ -104,12 +104,22 @@ become_controller(Pid, C2SPid) ->
gen_server:call(Pid, {become_controller, C2SPid}). gen_server:call(Pid, {become_controller, C2SPid}).
change_controller(Pid, C2SPid) -> change_controller(Pid, C2SPid) ->
gen_server:call(Pid, {change_controller, C2SPid}). case catch gen_server:call(Pid, {change_controller, C2SPid}) of
{'EXIT', _} ->
{error, einval};
Res ->
Res
end.
setopts(Pid, Opts) -> setopts(Pid, Opts) ->
case lists:member({active, false}, Opts) of case lists:member({active, false}, Opts) of
true -> true ->
gen_server:call(Pid, deactivate_socket); case catch gen_server:call(Pid, deactivate_socket) of
{'EXIT', _} ->
{error, einval};
Res ->
Res
end;
false -> false ->
ok ok
end. end.

View File

@ -153,8 +153,13 @@ setopts({http_bind, FsmRef, _IP}, Opts) ->
_ -> _ ->
case lists:member({active, false}, Opts) of case lists:member({active, false}, Opts) of
true -> true ->
gen_fsm:sync_send_all_state_event( case catch gen_fsm:sync_send_all_state_event(
FsmRef, deactivate_socket); FsmRef, deactivate_socket) of
{'EXIT', _} ->
{error, einval};
Res ->
Res
end;
_ -> _ ->
ok ok
end end