aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-03-01 14:11:28 +0100
committerIngela Anderton Andin <[email protected]>2016-03-01 14:11:28 +0100
commitaa74dd15c39d6b859456aafd78d435763436725d (patch)
tree201b5c338e4e4afb1181ccff52735073fec6153e /lib/kernel
parent532efc24803e19f47ce19124f4be16a42ac94a75 (diff)
parent75bc5bebc070a59535b8f6b7b9085c210b4723b5 (diff)
downloadotp-aa74dd15c39d6b859456aafd78d435763436725d.tar.gz
otp-aa74dd15c39d6b859456aafd78d435763436725d.tar.bz2
otp-aa74dd15c39d6b859456aafd78d435763436725d.zip
Merge branch 'maint'
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/erl_epmd.erl18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl
index 55ce9a7e64..c6202dd796 100644
--- a/lib/kernel/src/erl_epmd.erl
+++ b/lib/kernel/src/erl_epmd.erl
@@ -32,7 +32,7 @@
%% External exports
-export([start/0, start_link/0, stop/0, port_please/2,
port_please/3, names/0, names/1,
- register_node/2, open/0, open/1, open/2]).
+ register_node/2, register_node/3, open/0, open/1, open/2]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@@ -102,7 +102,9 @@ names(EpmdAddr) ->
register_node(Name, PortNo) ->
- gen_server:call(erl_epmd, {register, Name, PortNo}, infinity).
+ register_node(Name, PortNo, inet).
+register_node(Name, PortNo, Family) ->
+ gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity).
%%%----------------------------------------------------------------------
%%% Callback functions from gen_server
@@ -120,10 +122,10 @@ init(_) ->
-spec handle_call(calls(), term(), state()) ->
{'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}.
-handle_call({register, Name, PortNo}, _From, State) ->
+handle_call({register, Name, PortNo, Family}, _From, State) ->
case State#state.socket of
P when P < 0 ->
- case do_register_node(Name, PortNo) of
+ case do_register_node(Name, PortNo, Family) of
{alive, Socket, Creation} ->
S = State#state{socket = Socket,
port_no = PortNo,
@@ -206,8 +208,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) ->
close(Socket) ->
gen_tcp:close(Socket).
-do_register_node(NodeName, TcpPort) ->
- case open() of
+do_register_node(NodeName, TcpPort, Family) ->
+ Localhost = case Family of
+ inet -> open({127,0,0,1});
+ inet6 -> open({0,0,0,0,0,0,0,1})
+ end,
+ case Localhost of
{ok, Socket} ->
Name = to_string(NodeName),
Extra = "",