aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/socket_test_ttest_tcp_socket.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2019-05-23 15:14:29 +0200
committerMicael Karlberg <[email protected]>2019-05-29 13:47:40 +0200
commit0eb29c0eebd4e58f294005dbe355e270208756d9 (patch)
tree8b07c5deb0c4afa8fd7cbd8d3019de4d50098639 /erts/emulator/test/socket_test_ttest_tcp_socket.erl
parent56cad32ecdfa36ea7a4cddac1579eb1e414ec0fe (diff)
downloadotp-0eb29c0eebd4e58f294005dbe355e270208756d9.tar.gz
otp-0eb29c0eebd4e58f294005dbe355e270208756d9.tar.bz2
otp-0eb29c0eebd4e58f294005dbe355e270208756d9.zip
[esock|ttest] Make it possible use local for ttest
Make Unix Domain (stream) socket work with the ttest command line tool (for esock server and client). OTP-15822
Diffstat (limited to 'erts/emulator/test/socket_test_ttest_tcp_socket.erl')
-rw-r--r--erts/emulator/test/socket_test_ttest_tcp_socket.erl28
1 files changed, 15 insertions, 13 deletions
diff --git a/erts/emulator/test/socket_test_ttest_tcp_socket.erl b/erts/emulator/test/socket_test_ttest_tcp_socket.erl
index 8df1cdfad3..cf68bfe591 100644
--- a/erts/emulator/test/socket_test_ttest_tcp_socket.erl
+++ b/erts/emulator/test/socket_test_ttest_tcp_socket.erl
@@ -111,14 +111,15 @@ close(#{sock := Sock, reader := Pid}) ->
%% Create a socket and connect it to a peer
connect(ServerPath) when is_list(ServerPath) ->
- Domain = local,
- LocalSA = #{family => Domain,
- path => mk_unique_path()},
- ServerSA = #{family => Domain, path => ServerPath},
- Opts = #{domain => Domain,
- proto => default,
- method => plain},
- Cleanup = fun() -> os:cmd("unlink " ++ ServerPath), ok end,
+ Domain = local,
+ ClientPath = mk_unique_path(),
+ LocalSA = #{family => Domain,
+ path => ClientPath},
+ ServerSA = #{family => Domain, path => ServerPath},
+ Opts = #{domain => Domain,
+ proto => default,
+ method => plain},
+ Cleanup = fun() -> os:cmd("unlink " ++ ClientPath), ok end,
do_connect(LocalSA, ServerSA, Cleanup, Opts).
connect(Addr, Port) when is_tuple(Addr) andalso is_integer(Port) ->
@@ -135,11 +136,12 @@ connect(Addr, Port) when is_tuple(Addr) andalso is_integer(Port) ->
connect(ServerPath,
#{domain := local = Domain} = Opts)
when is_list(ServerPath) ->
- LocalSA = #{family => Domain,
- path => mk_unique_path()},
- ServerSA = #{family => Domain,
- path => ServerPath},
- Cleanup = fun() -> os:cmd("unlink " ++ ServerPath), ok end,
+ ClientPath = mk_unique_path(),
+ LocalSA = #{family => Domain,
+ path => ClientPath},
+ ServerSA = #{family => Domain,
+ path => ServerPath},
+ Cleanup = fun() -> os:cmd("unlink " ++ ClientPath), ok end,
do_connect(LocalSA, ServerSA, Cleanup, Opts#{proto => default}).
connect(Addr, Port, #{domain := Domain} = Opts) ->