25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Better handle errors in ejabberd_receiver calls

This commit is contained in:
Evgeniy Khramtsov 2017-03-02 16:02:44 +03:00
parent 4e014b4c5c
commit e5aac80cb4

View File

@ -157,8 +157,8 @@ handle_call({compress, Data}, _From,
{ok, ZlibData} -> {ok, ZlibData} ->
{reply, {ok, ZlibSocket}, {reply, {ok, ZlibSocket},
process_data(ZlibData, NewState), ?HIBERNATE_TIMEOUT}; process_data(ZlibData, NewState), ?HIBERNATE_TIMEOUT};
{error, _Reason} -> {error, _} = Err ->
{stop, normal, ok, NewState} {stop, normal, Err, NewState}
end; end;
handle_call(reset_stream, _From, State) -> handle_call(reset_stream, _From, State) ->
NewState = reset_parser(State), NewState = reset_parser(State),
@ -338,7 +338,10 @@ do_send(State, Data) ->
(State#state.sock_mod):send(State#state.socket, Data). (State#state.sock_mod):send(State#state.socket, Data).
do_call(Pid, Msg) -> do_call(Pid, Msg) ->
case catch ?GEN_SERVER:call(Pid, Msg) of try ?GEN_SERVER:call(Pid, Msg) of
{'EXIT', Why} -> {error, Why};
Res -> Res Res -> Res
catch _:{timeout, _} ->
{error, timeout};
_:_ ->
{error, einval}
end. end.