From 33321b08f1ce21de70ea79ae3407b7acaf78f02d Mon Sep 17 00:00:00 2001 From: SisMaker <156736github> Date: Mon, 14 Feb 2022 23:09:20 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20M=20F=20A=E6=B7=BB=E5=8A=A0=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen_apu.erl | 72 +++++++++++------------ src/gen_call.erl | 14 ++++- src/gen_emm.erl | 23 ++------ src/gen_ipc.erl | 30 ++-------- src/gen_srv.erl | 145 ++++++++++++++++++++++++++++++++++++++--------- 5 files changed, 173 insertions(+), 111 deletions(-) diff --git a/src/gen_apu.erl b/src/gen_apu.erl index 2815541..f8d9952 100644 --- a/src/gen_apu.erl +++ b/src/gen_apu.erl @@ -352,6 +352,7 @@ call(ServerRef, Request, Timeout) -> erlang:raise(Class, {Reason, {?MODULE, call, [ServerRef, Request]}}, ?STACKTRACE()) end. +-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. clfn(ServerRef, M, F, A) -> try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of {ok, Reply} -> @@ -360,6 +361,7 @@ clfn(ServerRef, M, F, A) -> erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) end. +-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. clfn(ServerRef, M, F, A, Timeout) -> try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of {ok, Reply} -> @@ -368,6 +370,7 @@ clfn(ServerRef, M, F, A, Timeout) -> erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) end. +-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. clfs(ServerRef, M, F, A) -> try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of {ok, Reply} -> @@ -376,6 +379,7 @@ clfs(ServerRef, M, F, A) -> erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) end. +-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. clfs(ServerRef, M, F, A, Timeout) -> try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of {ok, Reply} -> @@ -384,7 +388,7 @@ clfs(ServerRef, M, F, A, Timeout) -> erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) end. --spec csfn(ServerRef :: serverRef(), Msg :: term()) -> ok. +-spec csfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. csfn({global, Name}, M, F, A) -> try global:send(Name, {'$gen_csfn', {M, F, A}}), ok @@ -401,7 +405,7 @@ csfn(Dest, M, F, A) -> catch _:_ -> ok end. --spec csfs(ServerRef :: serverRef(), Msg :: term()) -> ok. +-spec csfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. csfs({global, Name}, M, F, A) -> try global:send(Name, {'$gen_csfs', {M, F, A}}), ok @@ -534,9 +538,6 @@ doAbcast(Nodes, Name, Msg) -> ], ok. -%% ----------------------------------------------------------------- -%% Send a reply to the client. -%% ----------------------------------------------------------------- %% Reply from a status machine callback to whom awaits in call/2 -spec reply([replyAction(), ...] | replyAction()) -> ok. reply({reply, {To, Tag}, Reply}) -> @@ -546,27 +547,13 @@ reply({reply, {To, Tag}, Reply}) -> ok end; reply(Replies) when is_list(Replies) -> - [ - begin - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end - end || {reply, {To, Tag}, Reply} <- Replies - ], + [gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies], ok. +-compile({inline, [reply/2]}). -spec reply(From :: from(), Reply :: term()) -> ok. -reply({_To, [alias | Alias] = Tag}, Reply) -> - Alias ! {Tag, Reply}, - ok; -reply({To, Tag}, Reply) -> - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end. +reply(From, Reply) -> + gen_call:reply(From, Reply). %% ----------------------------------------------------------------- %% Send a request to a generic server and return a Key which should be @@ -723,14 +710,14 @@ receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, Request); {'$gen_cast', Cast} -> matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Cast); - {'gen_clfn', MFA} -> - matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, MFA, false); - {'gen_clfs', MFA} -> - matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, MFA, true); + {'gen_clfn', From, MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, false); + {'gen_clfs', From, MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, true); {'gen_csfn', MFA} -> - matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, MFA, false); + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false, MFA, false); {'gen_csfs', MFA} -> - matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, MFA, true); + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false, MFA, true); {timeout, TimerRef, TimeoutName} -> case Timers of #{TimeoutName := {TimerRef, TimeoutMsg}} -> @@ -763,10 +750,10 @@ matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat end of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {{call, From}, Request}) end. @@ -783,15 +770,15 @@ matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat end of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {cast, Cast}) end. -matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, MFA, IsWithState) -> +matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, IsWithState) -> NewDebug = ?SYS_DEBUG(Debug, Name, {in, {mfa, MFA}}), try {M, F, A} = MFA, @@ -803,10 +790,10 @@ matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, M end of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, true) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, true); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {mfa, MFA}) end. @@ -815,10 +802,10 @@ matchInfoMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat NewDebug = ?SYS_DEBUG(Debug, Name, {in, {info, Msg}}), try Module:handleInfo(Msg, CurState) of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {info, Msg}) end. @@ -835,7 +822,7 @@ doAfterCall(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {doAfter, Args}) end. -handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Result, From) -> +handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Result, From, IsAnyRet) -> case Result of kpS -> receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); @@ -863,6 +850,13 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R terminate(exit, Reason, ?STACKTRACE(), Name, Module, NewDebug, Timers, NewState, {return, stop_reply}) after _ = reply(From, Reply) + end; + _AnyRet -> + case IsAnyRet of + true -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); + _ -> + terminate(exit, bad_ret, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, {return, _AnyRet}) end end. diff --git a/src/gen_call.erl b/src/gen_call.erl index 9856f6b..c12ffd8 100644 --- a/src/gen_call.erl +++ b/src/gen_call.erl @@ -1,6 +1,6 @@ -module(gen_call). --export([call/3, call/4]). +-export([call/3, call/4, reply/2]). -define(default_timeout, 5000). @@ -111,4 +111,14 @@ where(Name) -> whereis(Name); true -> undefined - end. \ No newline at end of file + end. + +%% +%% Send a reply to the client. +%% +reply({_To, [alias | Alias] = Tag}, Reply) when is_reference(Alias) -> + Alias ! {Tag, Reply}, ok; +reply({_To, [[alias | Alias] | _] = Tag}, Reply) when is_reference(Alias) -> + Alias ! {Tag, Reply}, ok; +reply({To, Tag}, Reply) -> + try To ! {Tag, Reply}, ok catch _:_ -> ok end. \ No newline at end of file diff --git a/src/gen_emm.erl b/src/gen_emm.erl index c20da28..9de2a2d 100644 --- a/src/gen_emm.erl +++ b/src/gen_emm.erl @@ -685,28 +685,15 @@ epmTerminate(#epmHer{epmM = EpmM, epmS = State} = EpmHer, Args, LastIn, Reason) ok end. +-compile({inline, [reply/2]}). -spec reply(From :: from(), Reply :: term()) -> ok. -reply({_To, [alias|Alias] = Tag}, Reply) -> - Alias ! {Tag, Reply}, - ok; -reply({To, Ref}, Msg) -> - try To ! {Ref, Msg}, - ok - catch _:_ -> - ok - end. +reply(From, Reply) -> + gen_call:reply(From, Reply). try_reply(false, _Msg) -> ignore; -try_reply({_To, [alias|Alias] = Tag}, Reply) -> - Alias ! {Tag, Reply}, - ok; -try_reply({To, Ref}, Msg) -> - try To ! {Ref, Msg}, - ok - catch _:_ -> - ok - end. +try_reply(From, Reply) -> + gen_call:reply(From, Reply). terminate_server(Reason, _Parent, _ServerName, EpmHers) -> epmStopAll(EpmHers), diff --git a/src/gen_ipc.erl b/src/gen_ipc.erl index 51d0ed6..daf2947 100644 --- a/src/gen_ipc.erl +++ b/src/gen_ipc.erl @@ -782,36 +782,18 @@ reply({reply, {To, Tag}, Reply}) -> ok end; reply(Replies) when is_list(Replies) -> - [ - begin - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end - end || {reply, {To, Tag}, Reply} <- Replies - ], + [gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies], ok. +-compile({inline, [reply/2]}). -spec reply(From :: from(), Reply :: term()) -> ok. -reply({_To, [alias|Alias] = Tag}, Reply) -> - Alias ! {Tag, Reply}, - ok; -reply({To, Tag}, Reply) -> - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end. +reply(From, Reply) -> + gen_call:reply(From, Reply). try_reply(false, _Msg) -> ignore; -try_reply({To, Ref}, Msg) -> - try To ! {Ref, Msg}, - ok - catch _:_ -> - ok - end. +try_reply(From, Reply) -> + gen_call:reply(From, Reply). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% API helpers end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% gen_event start %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/gen_srv.erl b/src/gen_srv.erl index 114448d..c8d7047 100644 --- a/src/gen_srv.erl +++ b/src/gen_srv.erl @@ -11,6 +11,7 @@ , start_monitor/3, start_monitor/4 , stop/1, stop/3 , call/2, call/3 + , clfn/4, clfn/5, clfs/4, clfs/5, csfn/4, csfs/4 , send_request/2, wait_response/2, receive_response/2, check_response/2 , cast/2, send/2, reply/1, reply/2 , abcast/2, abcast/3 @@ -347,6 +348,76 @@ call(ServerRef, Request, Timeout) -> erlang:raise(Class, {Reason, {?MODULE, call, [ServerRef, Request]}}, ?STACKTRACE()) end. +-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. +clfn(ServerRef, M, F, A) -> + try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of + {ok, Reply} -> + Reply + catch Class:Reason -> + erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) + end. + +-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. +clfn(ServerRef, M, F, A, Timeout) -> + try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of + {ok, Reply} -> + Reply + catch Class:Reason -> + erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) + end. + +-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. +clfs(ServerRef, M, F, A) -> + try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of + {ok, Reply} -> + Reply + catch Class:Reason -> + erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) + end. + +-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. +clfs(ServerRef, M, F, A, Timeout) -> + try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of + {ok, Reply} -> + Reply + catch Class:Reason -> + erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) + end. + +-spec csfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. +csfn({global, Name}, M, F, A) -> + try global:send(Name, {'$gen_csfn', {M, F, A}}), + ok + catch _:_ -> ok + end; +csfn({via, RegMod, Name}, M, F, A) -> + try RegMod:send(Name, {'$gen_csfn', {M, F, A}}), + ok + catch _:_ -> ok + end; +csfn(Dest, M, F, A) -> + try erlang:send(Dest, {'$gen_csfn', {M, F, A}}), + ok + catch _:_ -> ok + end. + +-spec csfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. +csfs({global, Name}, M, F, A) -> + try global:send(Name, {'$gen_csfs', {M, F, A}}), + ok + catch _:_ -> ok + end; +csfs({via, RegMod, Name}, M, F, A) -> + try RegMod:send(Name, {'$gen_csfs', {M, F, A}}), + ok + catch _:_ -> ok + end; +csfs(Dest, M, F, A) -> + try erlang:send(Dest, {'$gen_csfs', {M, F, A}}), + ok + catch _:_ -> ok + end. + %%% ----------------------------------------------------------------- %%% Make a call to servers at several nodes. %%% Returns: {[Replies],[BadNodes]} @@ -463,9 +534,6 @@ doAbcast(Nodes, Name, Msg) -> ], ok. -%% ----------------------------------------------------------------- -%% Send a reply to the client. -%% ----------------------------------------------------------------- %% Reply from a status machine callback to whom awaits in call/2 -spec reply([replyAction(), ...] | replyAction()) -> ok. reply({reply, {To, Tag}, Reply}) -> @@ -475,27 +543,13 @@ reply({reply, {To, Tag}, Reply}) -> ok end; reply(Replies) when is_list(Replies) -> - [ - begin - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end - end || {reply, {To, Tag}, Reply} <- Replies - ], + [gen_call:reply(From, Reply) || {reply, From, Reply} <- Replies], ok. +-compile({inline, [reply/2]}). -spec reply(From :: from(), Reply :: term()) -> ok. -reply({_To, [alias|Alias] = Tag}, Reply) -> - Alias ! {Tag, Reply}, - ok; -reply({To, Tag}, Reply) -> - try To ! {Tag, Reply}, - ok - catch _:_ -> - ok - end. +reply(From, Reply) -> + gen_call:reply(From, Reply). %% ----------------------------------------------------------------- %% Send a request to a generic server and return a Key which should be @@ -652,6 +706,14 @@ receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, Request); {'$gen_cast', Cast} -> matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Cast); + {'gen_clfn', From, MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, false); + {'gen_clfs', From, MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, true); + {'gen_csfn', MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false, MFA, false); + {'gen_csfs', MFA} -> + matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false, MFA, true); {timeout, TimerRef, TimeoutName} -> case Timers of #{TimeoutName := {TimerRef, TimeoutMsg}} -> @@ -676,10 +738,10 @@ matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat NewDebug = ?SYS_DEBUG(Debug, Name, {in, {{call, From}, Request}}), try Module:handleCall(Request, CurState, From) of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {{call, From}, Request}) end. @@ -688,22 +750,42 @@ matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat NewDebug = ?SYS_DEBUG(Debug, Name, {in, {cast, Cast}}), try Module:handleCast(Cast, CurState) of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {cast, Cast}) end. +matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, MFA, IsWithState) -> + NewDebug = ?SYS_DEBUG(Debug, Name, {in, {mfa, MFA}}), + try + {M, F, A} = MFA, + case IsWithState of + true -> + erlang:apply(M, F, A ++ [CurState]); + _ -> + erlang:apply(M, F, A) + end + of + Result -> + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, true) + catch + throw:Result -> + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, true); + Class:Reason:Strace -> + terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {mfa, MFA}) + end. + matchInfoMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Msg) -> NewDebug = ?SYS_DEBUG(Debug, Name, {in, {info, Msg}}), try Module:handleInfo(Msg, CurState) of Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) catch throw:Result -> - handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false); + handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false); Class:Reason:Strace -> terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {info, Msg}) end. @@ -720,7 +802,7 @@ doAfterCall(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {doAfter, Args}) end. -handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Result, From) -> +handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, Result, From, IsAnyRet) -> case Result of kpS -> receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); @@ -748,6 +830,13 @@ handleCR(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, R terminate(exit, Reason, ?STACKTRACE(), Name, Module, NewDebug, Timers, NewState, {return, stop_reply}) after _ = reply(From, Reply) + end; + _AnyRet -> + case IsAnyRet of + true -> + receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); + _ -> + terminate(exit, bad_ret, ?STACKTRACE(), Name, Module, Debug, Timers, CurState, {return, _AnyRet}) end end.