|
@ -352,6 +352,7 @@ call(ServerRef, Request, Timeout) -> |
|
|
erlang:raise(Class, {Reason, {?MODULE, call, [ServerRef, Request]}}, ?STACKTRACE()) |
|
|
erlang:raise(Class, {Reason, {?MODULE, call, [ServerRef, Request]}}, ?STACKTRACE()) |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. |
|
|
clfn(ServerRef, M, F, A) -> |
|
|
clfn(ServerRef, M, F, A) -> |
|
|
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of |
|
|
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}) of |
|
|
{ok, Reply} -> |
|
|
{ok, Reply} -> |
|
@ -360,6 +361,7 @@ clfn(ServerRef, M, F, A) -> |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
-spec clfn(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. |
|
|
clfn(ServerRef, M, F, A, Timeout) -> |
|
|
clfn(ServerRef, M, F, A, Timeout) -> |
|
|
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of |
|
|
try gen_call:call(ServerRef, '$gen_clfn', {M, F, A}, Timeout) of |
|
|
{ok, Reply} -> |
|
|
{ok, Reply} -> |
|
@ -368,6 +370,7 @@ clfn(ServerRef, M, F, A, Timeout) -> |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfn, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list()) -> ok. |
|
|
clfs(ServerRef, M, F, A) -> |
|
|
clfs(ServerRef, M, F, A) -> |
|
|
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of |
|
|
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}) of |
|
|
{ok, Reply} -> |
|
|
{ok, Reply} -> |
|
@ -376,6 +379,7 @@ clfs(ServerRef, M, F, A) -> |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
|
|
|
-spec clfs(ServerRef :: serverRef(), M :: module(), F :: atom(), A :: list(), Timeout :: timeout()) -> ok. |
|
|
clfs(ServerRef, M, F, A, Timeout) -> |
|
|
clfs(ServerRef, M, F, A, Timeout) -> |
|
|
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of |
|
|
try gen_call:call(ServerRef, '$gen_clfs', {M, F, A}, Timeout) of |
|
|
{ok, Reply} -> |
|
|
{ok, Reply} -> |
|
@ -384,7 +388,7 @@ clfs(ServerRef, M, F, A, Timeout) -> |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
erlang:raise(Class, {Reason, {?MODULE, clfs, [ServerRef, {M, F, A}]}}, ?STACKTRACE()) |
|
|
end. |
|
|
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) -> |
|
|
csfn({global, Name}, M, F, A) -> |
|
|
try global:send(Name, {'$gen_csfn', {M, F, A}}), |
|
|
try global:send(Name, {'$gen_csfn', {M, F, A}}), |
|
|
ok |
|
|
ok |
|
@ -401,7 +405,7 @@ csfn(Dest, M, F, A) -> |
|
|
catch _:_ -> ok |
|
|
catch _:_ -> ok |
|
|
end. |
|
|
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) -> |
|
|
csfs({global, Name}, M, F, A) -> |
|
|
try global:send(Name, {'$gen_csfs', {M, F, A}}), |
|
|
try global:send(Name, {'$gen_csfs', {M, F, A}}), |
|
|
ok |
|
|
ok |
|
@ -534,9 +538,6 @@ doAbcast(Nodes, Name, Msg) -> |
|
|
], |
|
|
], |
|
|
ok. |
|
|
ok. |
|
|
|
|
|
|
|
|
%% ----------------------------------------------------------------- |
|
|
|
|
|
%% Send a reply to the client. |
|
|
|
|
|
%% ----------------------------------------------------------------- |
|
|
|
|
|
%% Reply from a status machine callback to whom awaits in call/2 |
|
|
%% Reply from a status machine callback to whom awaits in call/2 |
|
|
-spec reply([replyAction(), ...] | replyAction()) -> ok. |
|
|
-spec reply([replyAction(), ...] | replyAction()) -> ok. |
|
|
reply({reply, {To, Tag}, Reply}) -> |
|
|
reply({reply, {To, Tag}, Reply}) -> |
|
@ -546,27 +547,13 @@ reply({reply, {To, Tag}, Reply}) -> |
|
|
ok |
|
|
ok |
|
|
end; |
|
|
end; |
|
|
reply(Replies) when is_list(Replies) -> |
|
|
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. |
|
|
ok. |
|
|
|
|
|
|
|
|
|
|
|
-compile({inline, [reply/2]}). |
|
|
-spec reply(From :: from(), Reply :: term()) -> ok. |
|
|
-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 |
|
|
%% 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); |
|
|
matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, From, Request); |
|
|
{'$gen_cast', Cast} -> |
|
|
{'$gen_cast', Cast} -> |
|
|
matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, 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} -> |
|
|
{'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} -> |
|
|
{'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} -> |
|
|
{timeout, TimerRef, TimeoutName} -> |
|
|
case Timers of |
|
|
case Timers of |
|
|
#{TimeoutName := {TimerRef, TimeoutMsg}} -> |
|
|
#{TimeoutName := {TimerRef, TimeoutMsg}} -> |
|
@ -763,10 +750,10 @@ matchCallMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat |
|
|
end |
|
|
end |
|
|
of |
|
|
of |
|
|
Result -> |
|
|
Result -> |
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From) |
|
|
|
|
|
|
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, false) |
|
|
catch |
|
|
catch |
|
|
throw:Result -> |
|
|
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 -> |
|
|
Class:Reason:Strace -> |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {{call, From}, Request}) |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {{call, From}, Request}) |
|
|
end. |
|
|
end. |
|
@ -783,15 +770,15 @@ matchCastMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat |
|
|
end |
|
|
end |
|
|
of |
|
|
of |
|
|
Result -> |
|
|
Result -> |
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) |
|
|
|
|
|
|
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) |
|
|
catch |
|
|
catch |
|
|
throw:Result -> |
|
|
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 -> |
|
|
Class:Reason:Strace -> |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {cast, Cast}) |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {cast, Cast}) |
|
|
end. |
|
|
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}}), |
|
|
NewDebug = ?SYS_DEBUG(Debug, Name, {in, {mfa, MFA}}), |
|
|
try |
|
|
try |
|
|
{M, F, A} = MFA, |
|
|
{M, F, A} = MFA, |
|
@ -803,10 +790,10 @@ matchMFA(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, M |
|
|
end |
|
|
end |
|
|
of |
|
|
of |
|
|
Result -> |
|
|
Result -> |
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) |
|
|
|
|
|
|
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, From, true) |
|
|
catch |
|
|
catch |
|
|
throw:Result -> |
|
|
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 -> |
|
|
Class:Reason:Strace -> |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {mfa, MFA}) |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {mfa, MFA}) |
|
|
end. |
|
|
end. |
|
@ -815,10 +802,10 @@ matchInfoMsg(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurStat |
|
|
NewDebug = ?SYS_DEBUG(Debug, Name, {in, {info, Msg}}), |
|
|
NewDebug = ?SYS_DEBUG(Debug, Name, {in, {info, Msg}}), |
|
|
try Module:handleInfo(Msg, CurState) of |
|
|
try Module:handleInfo(Msg, CurState) of |
|
|
Result -> |
|
|
Result -> |
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false) |
|
|
|
|
|
|
|
|
handleCR(Parent, Name, Module, HibernateAfterTimeout, NewDebug, Timers, CurState, Result, false, false) |
|
|
catch |
|
|
catch |
|
|
throw:Result -> |
|
|
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 -> |
|
|
Class:Reason:Strace -> |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {info, Msg}) |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {info, Msg}) |
|
|
end. |
|
|
end. |
|
@ -835,7 +822,7 @@ doAfterCall(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {doAfter, Args}) |
|
|
terminate(Class, Reason, Strace, Name, Module, NewDebug, Timers, CurState, {doAfter, Args}) |
|
|
end. |
|
|
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 |
|
|
case Result of |
|
|
kpS -> |
|
|
kpS -> |
|
|
receiveIng(Parent, Name, Module, HibernateAfterTimeout, Debug, Timers, CurState, false); |
|
|
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}) |
|
|
terminate(exit, Reason, ?STACKTRACE(), Name, Module, NewDebug, Timers, NewState, {return, stop_reply}) |
|
|
after |
|
|
after |
|
|
_ = reply(From, Reply) |
|
|
_ = 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 |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|