aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-04-12 12:01:20 +0200
committerHans Nilsson <[email protected]>2019-04-12 12:01:20 +0200
commitc24ea58313c7a2b837831c9c8f9439d0ababe5df (patch)
treed6fdae26033aa9a59cf4127f31fb9eb4fd419ed9 /lib
parent1d5433d877fc7302122bbb6a28feb1392bf6f64b (diff)
parentcee66a3a287abc9b96ce019ea3e9cf2a38d283e0 (diff)
downloadotp-c24ea58313c7a2b837831c9c8f9439d0ababe5df.tar.gz
otp-c24ea58313c7a2b837831c9c8f9439d0ababe5df.tar.bz2
otp-c24ea58313c7a2b837831c9c8f9439d0ababe5df.zip
Merge branch 'maint-21' into maint
* maint-21: ssh: Present peername for accept_callback fun also for Sockets ssh: Add ssh_channel:init/1
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh.erl2
-rw-r--r--lib/ssh/src/ssh_channel.erl4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index 9281bf84a7..ff5aee14d7 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -127,7 +127,7 @@ connect(Socket, UserOptions, NegotiationTimeout) when is_port(Socket),
Options ->
case valid_socket_to_use(Socket, ?GET_OPT(transport,Options)) of
ok ->
- {ok, {Host,_Port}} = inet:sockname(Socket),
+ {ok, {Host,_Port}} = inet:peername(Socket),
Opts = ?PUT_INTERNAL_OPT([{user_pid,self()}, {host,Host}], Options),
ssh_connection_handler:start_connection(client, Socket, Opts, NegotiationTimeout);
{error,SockError} ->
diff --git a/lib/ssh/src/ssh_channel.erl b/lib/ssh/src/ssh_channel.erl
index 443bd05086..1d977e3bc9 100644
--- a/lib/ssh/src/ssh_channel.erl
+++ b/lib/ssh/src/ssh_channel.erl
@@ -58,6 +58,7 @@
State::term()}.
%%% API
-export([start/4, start/5, start_link/4, start_link/5, call/2, call/3,
+ init/1,
cast/2, reply/2, enter_loop/1]).
%%====================================================================
@@ -76,6 +77,9 @@ cast(ChannelPid, Msg) ->
reply(From, Msg) ->
ssh_client_channel:reply(From, Msg).
+init(Args) ->
+ ssh_client_channel:init(Args).
+
start(ConnectionManager, ChannelId, CallBack, CbInitArgs) ->
ssh_client_channel:start(ConnectionManager, ChannelId, CallBack, CbInitArgs).