Quellcode durchsuchen

ft: erpc 替换rpc

master
SisMaker vor 3 Jahren
Ursprung
Commit
6c33843f05
10 geänderte Dateien mit 17 neuen und 17 gelöschten Zeilen
  1. +1
    -1
      src/comMisc/utPid.erl
  2. +2
    -2
      src/hotUpdate/h.erl
  3. +3
    -3
      src/hotUpdate/hot_swap.erl
  4. +1
    -1
      src/hotUpdate/u.erl
  5. +2
    -2
      src/hotUpdate/u1.erl
  6. +1
    -1
      src/hotUpdate/u2.erl
  7. +3
    -3
      src/recon-2.5.1/src/recon.erl
  8. +2
    -2
      src/srvNodeMgr/node_misc.erl
  9. +1
    -1
      src/srvNodeMgr/utStopSrv1.escript
  10. +1
    -1
      src/srvNodeMgr/utStopSrv2.escript

+ 1
- 1
src/comMisc/utPid.erl Datei anzeigen

@ -36,7 +36,7 @@ is_process_alive(Pid) ->
Node = node(),
Result = case node(Pid) of
Node -> erlang:is_process_alive(Pid);
Node1 -> rpc:call(Node1, erlang, is_process_alive, [Pid])
Node1 -> erpc:call(Node1, erlang, is_process_alive, [Pid])
end,
case Result of
{badrpc, _Reason} -> false;

+ 2
- 2
src/hotUpdate/h.erl Datei anzeigen

@ -67,7 +67,7 @@ kf_load_beam(Files) ->
Modules = [list_to_atom(filename:basename(File, ".erl")) || File <- Files],
case nodes(connected) of
[Node | _] ->
rpc:cast(Node, ?MODULE, kf_load_beam_all_server_in_local_node, [Modules]);
erpc:cast(Node, ?MODULE, kf_load_beam_all_server_in_local_node, [Modules]);
_ ->
skip
end,
@ -91,7 +91,7 @@ nodes_load(Modules) ->
catch load(Modules),
%
ContenctedNodes = nodes(connected),
[rpc:cast(Node, ?MODULE, load, [Modules]) || Node <- ContenctedNodes].
[erpc:cast(Node, ?MODULE, load, [Modules]) || Node <- ContenctedNodes].
load(Modules) -> [c:nl(M) || M <- Modules].

+ 3
- 3
src/hotUpdate/hot_swap.erl Datei anzeigen

@ -19,7 +19,7 @@ load(ModList) ->
%% @param ModList ()
network_load(ModList) ->
lists:foreach(fun(Module) ->
[begin rpc:call(Node, code, purge, [Module]), rpc:call(Node, code, load_file, [Module]) end || Node <- (nodes() ++ [node()])]
[begin erpc:call(Node, code, purge, [Module]), erpc:call(Node, code, load_file, [Module]) end || Node <- (nodes() ++ [node()])]
end, ModList).
%%
@ -28,8 +28,8 @@ network_load(ModList) ->
network_load(NodeList, ModList) ->
lists:foreach(fun(Node) ->
lists:foreach(fun(Module) ->
rpc:call(Node, code, purge, [Module]),
rpc:call(Node, code, load_file, [Module])
erpc:call(Node, code, purge, [Module]),
erpc:call(Node, code, load_file, [Module])
end, ModList)
end, NodeList).

+ 1
- 1
src/hotUpdate/u.erl Datei anzeigen

@ -116,7 +116,7 @@ info(V, P) ->
loads([], _Files) -> ok;
loads([H | T], Files) ->
info("[~w]", [H#server.node]),
rpc:cast(H#server.node, u, load, [Files]),
erpc:cast(H#server.node, u, load, [Files]),
loads(T, Files).
get_new_file(Files, S) ->

+ 2
- 2
src/hotUpdate/u1.erl Datei anzeigen

@ -98,7 +98,7 @@ info(V, P) ->
%% loads([], _Files) -> ok;
%% loads([H | T], Files) ->
%% info("[~w]", [H#t_server_node.node]),
%% rpc:cast(H#t_server_node.node, u, load, [Files]),
%% erpc:cast(H#t_server_node.node, u, load, [Files]),
%% loads(T, Files).
get_new_file(Files, S) ->
@ -155,7 +155,7 @@ a() ->
hotswap(NodeArg) ->
Node = util_data:to_atom(hd(NodeArg)),
net_adm:ping(Node),
rpc:call(Node, ?MODULE, do_hotswap, []).
erpc:call(Node, ?MODULE, do_hotswap, []).
do_hotswap() ->
CommandFile = "../../hotswap/hotswap_command.txt",

+ 1
- 1
src/hotUpdate/u2.erl Datei anzeigen

@ -99,7 +99,7 @@ info(V, P) ->
loads([], _Files) -> ok;
loads([H | T], Files) ->
info("[~w]", [H]),
rpc:cast(H, u, load, [Files]),
erpc:cast(H, u, load, [Files]),
loads(T, Files).
get_new_file(Files, S) ->

+ 3
- 3
src/recon-2.5.1/src/recon.erl Datei anzeigen

@ -491,7 +491,7 @@ remote_load(Mod) -> remote_load(nodes(), Mod).
Nodes :: [node(),...] | node().
remote_load(Nodes=[_|_], Mod) when is_atom(Mod) ->
{Mod, Bin, File} = code:get_object_code(Mod),
rpc:multicall(Nodes, code, load_binary, [Mod, File, Bin]);
erpc:multicall(Nodes, code, load_binary, [Mod, File, Bin]);
remote_load(Nodes=[_|_], Modules) when is_list(Modules) ->
[remote_load(Nodes, Mod) || Mod <- Modules];
remote_load(Node, Mod) ->
@ -689,7 +689,7 @@ rpc(Nodes, Fun) ->
%% @doc Runs an arbitrary fun (of arity 0) over one or more nodes.
-spec rpc(node()|[node(),...], fun(() -> term()), timeout()) -> {[Success::_],[Fail::_]}.
rpc(Nodes=[_|_], Fun, Timeout) when is_function(Fun,0) ->
rpc:multicall(Nodes, erlang, apply, [Fun,[]], Timeout);
erpc:multicall(Nodes, erlang, apply, [Fun,[]], Timeout);
rpc(Node, Fun, Timeout) when is_atom(Node) ->
rpc([Node], Fun, Timeout).
@ -707,7 +707,7 @@ named_rpc(Nodes, Fun) ->
%% name of the node that computed a given result along with it, in a tuple.
-spec named_rpc(node()|[node(),...], fun(() -> term()), timeout()) -> {[Success::_],[Fail::_]}.
named_rpc(Nodes=[_|_], Fun, Timeout) when is_function(Fun,0) ->
rpc:multicall(Nodes, erlang, apply, [fun() -> {node(),Fun()} end,[]], Timeout);
erpc:multicall(Nodes, erlang, apply, [fun() -> {node(),Fun()} end,[]], Timeout);
named_rpc(Node, Fun, Timeout) when is_atom(Node) ->
named_rpc([Node], Fun, Timeout).

+ 2
- 2
src/srvNodeMgr/node_misc.erl Datei anzeigen

@ -41,7 +41,7 @@ cookie_hash() ->
base64:encode_to_string(erlang:md5(atom_to_list(erlang:get_cookie()))).
is_running(Node, Application) ->
case rpc:call(Node, app_utils, which_applications, []) of
case erpc:call(Node, app_utils, which_applications, []) of
{badrpc, _} ->
false;
Apps ->
@ -49,7 +49,7 @@ is_running(Node, Application) ->
end.
is_process_running(Node, Process) ->
case rpc:call(Node, erlang, whereis, [Process]) of
case erpc:call(Node, erlang, whereis, [Process]) of
{badrpc, _} ->
false;
undefined ->

+ 1
- 1
src/srvNodeMgr/utStopSrv1.escript Datei anzeigen

@ -12,7 +12,7 @@ main(_Arge) ->
pong ->
io:format("the aims server:~p is online~n", [?AIM_NODE]),
io:format("to close it~n"),
rpc:call(?AIM_NODE, init, stop, []),
erpc:call(?AIM_NODE, init, stop, []),
halt(0);
_ ->
io:format("the aims server:~p is not online~n", [?AIM_NODE]),

+ 1
- 1
src/srvNodeMgr/utStopSrv2.escript Datei anzeigen

@ -11,7 +11,7 @@ main(_Args) ->
io:format("the aims server:~p is online~n", [?AIM_NODE]),
io:format("to close it~n"),
timer:sleep(10000),
rpc:call(?AIM_NODE, init, stop, []),
erpc:call(?AIM_NODE, init, stop, []),
halt(0);
_ ->
io:format("the aims server:~p is online~n", [?AIM_NODE]),

Laden…
Abbrechen
Speichern