aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-03-02 16:51:11 +0100
committerSverker Eriksson <[email protected]>2018-03-02 19:16:48 +0100
commite8d0a8654ecf85f89a0c0f7aa26da8bc467e9373 (patch)
tree203555cff1211a7aa885e782083ba1e4584d24e3 /lib/stdlib/src/gen.erl
parent96aba63465135d5e2537b42e5167b2863957915c (diff)
downloadotp-e8d0a8654ecf85f89a0c0f7aa26da8bc467e9373.tar.gz
otp-e8d0a8654ecf85f89a0c0f7aa26da8bc467e9373.tar.bz2
otp-e8d0a8654ecf85f89a0c0f7aa26da8bc467e9373.zip
stdlib: Remove obsolete use of monitor_node
as fallback when erlang:monitor failed toward primitive nodes, which it does not do in OTP-21.
Diffstat (limited to 'lib/stdlib/src/gen.erl')
-rw-r--r--lib/stdlib/src/gen.erl38
1 files changed, 2 insertions, 36 deletions
diff --git a/lib/stdlib/src/gen.erl b/lib/stdlib/src/gen.erl
index 0e6f49d99f..dc957b4d4e 100644
--- a/lib/stdlib/src/gen.erl
+++ b/lib/stdlib/src/gen.erl
@@ -158,8 +158,7 @@ call(Process, Label, Request, Timeout)
do_for_proc(Process, Fun).
do_call(Process, Label, Request, Timeout) ->
- try erlang:monitor(process, Process) of
- Mref ->
+ Mref = erlang:monitor(process, Process),
%% If the monitor/2 call failed to set up a connection to a
%% remote node, we don't want the '!' operator to attempt
%% to set up the connection again. (If the monitor/2 call
@@ -183,27 +182,7 @@ do_call(Process, Label, Request, Timeout) ->
after Timeout ->
erlang:demonitor(Mref, [flush]),
exit(timeout)
- end
- catch
- error:_ ->
- %% Node (C/Java?) is not supporting the monitor.
- %% The other possible case -- this node is not distributed
- %% -- should have been handled earlier.
- %% Do the best possible with monitor_node/2.
- %% This code may hang indefinitely if the Process
- %% does not exist. It is only used for featureweak remote nodes.
- Node = get_node(Process),
- monitor_node(Node, true),
- receive
- {nodedown, Node} ->
- monitor_node(Node, false),
- exit({nodedown, Node})
- after 0 ->
- Tag = make_ref(),
- Process ! {Label, {self(), Tag}, Request},
- wait_resp(Node, Tag, Timeout)
- end
- end.
+ end.
get_node(Process) ->
%% We trust the arguments to be correct, i.e
@@ -217,19 +196,6 @@ get_node(Process) ->
node(Process)
end.
-wait_resp(Node, Tag, Timeout) ->
- receive
- {Tag, Reply} ->
- monitor_node(Node, false),
- {ok, Reply};
- {nodedown, Node} ->
- monitor_node(Node, false),
- exit({nodedown, Node})
- after Timeout ->
- monitor_node(Node, false),
- exit(timeout)
- end.
-
%%
%% Send a reply to the client.
%%