aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test/ei_accept_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-08-24 20:34:16 +0200
committerSverker Eriksson <[email protected]>2017-11-15 20:10:33 +0100
commit966b0f9b4095984abd2c5196d40c4e15d5d1a06c (patch)
tree73b7fcee44b3340206f6fb62cf6ac13a45b1ed94 /lib/erl_interface/test/ei_accept_SUITE.erl
parentd736e87ff94ab8191f33dca55516e6c1d440b915 (diff)
downloadotp-966b0f9b4095984abd2c5196d40c4e15d5d1a06c.tar.gz
otp-966b0f9b4095984abd2c5196d40c4e15d5d1a06c.tar.bz2
otp-966b0f9b4095984abd2c5196d40c4e15d5d1a06c.zip
erl_interface: Refactor ei_accept_SUITE
in order to call ei_publish() separately.
Diffstat (limited to 'lib/erl_interface/test/ei_accept_SUITE.erl')
-rw-r--r--lib/erl_interface/test/ei_accept_SUITE.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/erl_interface/test/ei_accept_SUITE.erl b/lib/erl_interface/test/ei_accept_SUITE.erl
index e06ee762d7..8881eb85bd 100644
--- a/lib/erl_interface/test/ei_accept_SUITE.erl
+++ b/lib/erl_interface/test/ei_accept_SUITE.erl
@@ -59,7 +59,8 @@ ei_accept(Config) when is_list(Config) ->
spawn(F),
Port = 6543,
- {ok, Fd, _Node} = ei_accept(P, Port),
+ {ok, ListenFd} = ei_publish(P, Port),
+ {ok, Fd, _Node} = ei_accept(P, ListenFd),
TermReceived= ei_receive(P, Fd),
io:format("Sent ~p received ~p ~n", [TermToSend, TermReceived]),
TermToSend= TermReceived,
@@ -137,8 +138,15 @@ ei_connect_init(P, Num, Cookie, Creation) ->
{term,Int} when is_integer(Int) -> Int
end.
-ei_accept(P, PortNo) ->
- send_command(P, ei_accept, [PortNo]),
+ei_publish(P, PortNo) ->
+ send_command(P, ei_publish, [PortNo]),
+ case get_term(P) of
+ {term,{ListenFd, EpmdFd, _}} when ListenFd >= 0, EpmdFd >= 0 -> {ok, ListenFd};
+ {term,{_, _, Errno}} -> {error,Errno}
+ end.
+
+ei_accept(P, ListenFd) ->
+ send_command(P, ei_accept, [ListenFd]),
case get_term(P) of
{term,{Fd, _, Node}} when Fd >= 0 -> {ok, Fd, Node};
{term,{_Fd, Errno, _Node}} -> {error,Errno}