aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-09-20 15:06:07 +0200
committerSverker Eriksson <[email protected]>2017-11-15 20:13:03 +0100
commit771abbd23709b5a03416278595588931889ab7c5 (patch)
tree75dc9fd1f206cdd95430a3832295bb9cc81298d3 /lib/kernel
parent08040e5c5cd329395d9d756f1fdf8d66ffbbe705 (diff)
downloadotp-771abbd23709b5a03416278595588931889ab7c5.tar.gz
otp-771abbd23709b5a03416278595588931889ab7c5.tar.bz2
otp-771abbd23709b5a03416278595588931889ab7c5.zip
erts: Keep magic ref to DistEntry in net_kernel
to make sure it's kept alive.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/net_kernel.erl17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl
index f929e4bf11..eee915b15b 100644
--- a/lib/kernel/src/net_kernel.erl
+++ b/lib/kernel/src/net_kernel.erl
@@ -435,10 +435,10 @@ handle_connect(ConnLookup, Type, Node, ConnId, From , State) ->
-define(ERTS_DIST_CON_ID_MASK, 16#ffffff). % also in external.h
-verify_new_conn_id([], ConnId)
- when (ConnId band (bnot ?ERTS_DIST_CON_ID_MASK)) =:= 0 ->
+verify_new_conn_id([], {Nr,_DHandle})
+ when (Nr band (bnot ?ERTS_DIST_CON_ID_MASK)) =:= 0 ->
true;
-verify_new_conn_id([#connection{conn_id = Old}], New)
+verify_new_conn_id([#connection{conn_id = {Old,_}}], {New,_})
when New =:= ((Old+1) band ?ERTS_DIST_CON_ID_MASK) ->
true;
verify_new_conn_id(_, _) ->
@@ -460,7 +460,7 @@ handle_call({auto_connect, Type, Node, WaitForBarred}, From, State) ->
verbose({auto_connect, Type, Node, WaitForBarred}, 1, State),
R = case (catch erlang:new_connection_id(Node)) of
- ConnId when is_integer(ConnId) ->
+ {Nr,_DHandle}=ConnId when is_integer(Nr) ->
handle_auto_connect(Type, Node, ConnId, WaitForBarred, From, State);
_Error ->
@@ -481,7 +481,7 @@ handle_call({connect, Type, Node}, From, State) ->
verbose({connect, Type, Node}, 1, State),
ConnLookup = ets:lookup(sys_dist, Node),
R = case (catch erlang:new_connection_id(Node)) of
- ConnId when is_integer(ConnId) ->
+ {Nr,_DHandle}=ConnId when is_integer(Nr) ->
handle_connect(ConnLookup, Type, Node, ConnId, From, State);
_Error ->
@@ -699,8 +699,9 @@ terminate(_Reason, State) ->
%%
%% Asynchronous auto connect request
%%
-handle_info({auto_connect,Node,ConnId}, State) ->
- verbose({auto_connect, Node, ConnId}, 1, State),
+handle_info({auto_connect,Node, Nr, DHandle}, State) ->
+ verbose({auto_connect, Node, Nr, DHandle}, 1, State),
+ ConnId = {Nr, DHandle},
NewState =
case handle_auto_connect(normal, Node, ConnId, false, noreply, State) of
{noreply, S} -> %% Pending connection
@@ -796,7 +797,7 @@ handle_info({AcceptPid, {accept_pending,MyNode,Node,Address,Type}}, State) ->
{noreply, State};
_ ->
ConnId = case (catch erlang:new_connection_id(Node)) of
- CI when is_integer(CI) -> CI
+ {Nr,_DHandle}=CI when is_integer(Nr) -> CI
%% SVERK What to do?
end,
ets:insert(sys_dist, #connection{node = Node,