Skip to content

Commit abe7e48

Browse files
author
UENISHI Kota
committed
erlang: error doesn't cause connection failure
1 parent e621d63 commit abe7e48

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

erlang/src/mp_session.erl

+9-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ behaviour_info(_Other) ->
5252
%% see mp_server_sup:start_client for caller.
5353
%%--------------------------------------------------------------------
5454
start_link(Module,Socket) when is_atom(Module), is_port(Socket)->
55-
gen_server:start_link(?MODULE, [Module,Socket], [{debug,[trace,log,statistics]}]).
55+
% gen_server:start_link(?MODULE, [Module,Socket], [{debug,[trace,log,statistics]}]).
56+
gen_server:start_link(?MODULE, [Module,Socket], []).
5657

5758
% TBF:
5859
% notify(Node, Type, Method, Parms)->
@@ -201,5 +202,12 @@ handle_request(?MP_TYPE_REQUEST, CallID, Module, M, Argv,Socket, Context) when i
201202
error_logger:error_msg("no such method: ~p:~s/~p~n", [Module,binary_to_list(M),length(Argv)]),
202203
ok=gen_tcp:send(Socket, msgpack:pack([?MP_TYPE_RESPONSE, CallID, false, nil])),
203204
ok=inet:setopts(Socket, [{active,once}, {packet,raw}]),
205+
{ok, Context};
206+
207+
_:What ->
208+
error_logger:error_msg("unknown error: ~p (~p:~s/~p)~n", [What, Module,binary_to_list(M),length(Argv)]),
209+
ok=gen_tcp:send(Socket, msgpack:pack([?MP_TYPE_RESPONSE, CallID, false, nil])),
210+
ok=inet:setopts(Socket, [{active,once}, {packet,raw}]),
204211
{ok, Context}
212+
205213
end.

0 commit comments

Comments
 (0)