diff options
Diffstat (limited to 'lib/ssh/test')
-rw-r--r-- | lib/ssh/test/ssh_basic_SUITE.erl | 14 | ||||
-rw-r--r-- | lib/ssh/test/ssh_peername_sockname_server.erl | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index 813031eab2..b9745dda9c 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -478,7 +478,7 @@ send(Config) when is_list(Config) -> %%-------------------------------------------------------------------- peername_sockname() -> - [{doc, "Test ssh:peername/1 and ssh:sockname/1"}]. + [{doc, "Test ssh:connection_info([peername, sockname])"}]. peername_sockname(Config) when is_list(Config) -> process_flag(trap_exit, true), SystemDir = filename:join(?config(priv_dir, Config), system), @@ -496,13 +496,17 @@ peername_sockname(Config) when is_list(Config) -> {user_interaction, false}]), {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), success = ssh_connection:subsystem(ConnectionRef, ChannelId, "peername_sockname", infinity), - {ok,{HostPeerClient,PortPeerClient}} = ssh:peername(ConnectionRef), - {ok,{HostSockClient,PortSockClient}} = ssh:sockname(ConnectionRef), + [{peer, {_Name, {HostPeerClient,PortPeerClient} = ClientPeer}}] = + ssh:connection_info(ConnectionRef, [peer]), + [{sockname, {HostSockClient,PortSockClient} = ClientSock}] = + ssh:connection_info(ConnectionRef, [sockname]), + ct:pal("Client: ~p ~p", [ClientPeer, ClientSock]), receive {ssh_cm, ConnectionRef, {data, ChannelId, _, Response}} -> {PeerNameSrv,SockNameSrv} = binary_to_term(Response), - {ok,{HostPeerSrv,PortPeerSrv}} = PeerNameSrv, - {ok,{HostSockSrv,PortSockSrv}} = SockNameSrv, + {HostPeerSrv,PortPeerSrv} = PeerNameSrv, + {HostSockSrv,PortSockSrv} = SockNameSrv, + ct:pal("Server: ~p ~p", [PeerNameSrv, SockNameSrv]), host_equal(HostPeerSrv, HostSockClient), PortPeerSrv = PortSockClient, host_equal(HostSockSrv, HostPeerClient), diff --git a/lib/ssh/test/ssh_peername_sockname_server.erl b/lib/ssh/test/ssh_peername_sockname_server.erl index 7664f3ee25..bc505695d3 100644 --- a/lib/ssh/test/ssh_peername_sockname_server.erl +++ b/lib/ssh/test/ssh_peername_sockname_server.erl @@ -34,12 +34,10 @@ init([]) -> {ok, #state{}}. handle_msg({ssh_channel_up, ChannelId, ConnectionManager}, State) -> + [{peer, {_Name, Peer}}] = ssh:connection_info(ConnectionManager, [peer]), + [{sockname, Sock}] = ssh:connection_info(ConnectionManager, [sockname]), ssh_connection:send(ConnectionManager, ChannelId, - term_to_binary( - {catch ssh:peername(ConnectionManager), - catch ssh:sockname(ConnectionManager) - }) - ), + term_to_binary({Peer, Sock})), {ok, State}. handle_ssh_msg({ssh_cm, _, {exit_signal, ChannelId, _, _Error, _}}, |