From 0eb29c0eebd4e58f294005dbe355e270208756d9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 23 May 2019 15:14:29 +0200 Subject: [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 --- .../emulator/test/socket_test_ttest_tcp_socket.erl | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'erts/emulator/test/socket_test_ttest_tcp_socket.erl') 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) -> -- cgit v1.2.3