diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/src/rpc.erl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/kernel/src/rpc.erl b/lib/kernel/src/rpc.erl index ee71d39253..21bff02214 100644 --- a/lib/kernel/src/rpc.erl +++ b/lib/kernel/src/rpc.erl @@ -63,7 +63,7 @@ %%------------------------------------------------------------------------ --type state() :: gb_trees:tree(pid(), {pid(), reference()}). +-type state() :: map(). %%------------------------------------------------------------------------ @@ -91,7 +91,7 @@ stop(Rpc) -> init([]) -> process_flag(trap_exit, true), - {ok, gb_trees:empty()}. + {ok, maps:new()}. -spec handle_call(term(), term(), state()) -> {'noreply', state()} | @@ -131,14 +131,14 @@ handle_cast(_, S) -> -spec handle_info(term(), state()) -> {'noreply', state()}. handle_info({'DOWN', _, process, Caller, normal}, S) -> - {noreply, gb_trees:delete(Caller, S)}; + {noreply, maps:remove(Caller, S)}; handle_info({'DOWN', _, process, Caller, Reason}, S) -> - case gb_trees:lookup(Caller, S) of - {value, To} -> + case maps:get(Caller, S, undefined) of + undefined -> + {noreply, S}; + {_, _} = To -> gen_server:reply(To, {badrpc, {'EXIT', Reason}}), - {noreply, gb_trees:delete(Caller, S)}; - none -> - {noreply, S} + {noreply, maps:remove(Caller, S)} end; handle_info({From, {sbcast, Name, Msg}}, S) -> _ = case catch Name ! Msg of %% use catch to get the printout @@ -192,7 +192,7 @@ handle_call_call(Mod, Fun, Args, Gleader, To, S) -> end, gen_server:reply(To, Reply) end), - {noreply, gb_trees:insert(Caller, To, S)}. + {noreply, maps:put(Caller, To, S)}. %% RPC aid functions .... |