diff options
author | Essien Ita Essien <essiene@gmail.com> | 2008-12-16 22:44:45 +0100 |
---|---|---|
committer | Essien Ita Essien <essiene@gmail.com> | 2008-12-16 22:44:45 +0100 |
commit | 0f63f07f2ac278ba95fcf70970ea379eae080371 (patch) | |
tree | 559a8206295e55628a7122e26780c01f1f312e42 | |
parent | 49f4f2a37e9cdff365bb1ec31b09f13aa3618740 (diff) | |
download | rabbitmq-server-ssl_async_recv.tar.gz |
Hook in the new #rabbit_ssl_socket{} into the whole process.ssl_async_recv
- ssl_connection_upgrade now creates a rabbit_ssl_socket() and passes
that to the normal start_client/1 and hopefully everything works fine.
- updated more of the network calls to use rabbit_net in
rabbit_networking.erl too
-rw-r--r-- | src/rabbit_networking.erl | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index 136b5b9c..66233ed4 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -39,7 +39,7 @@ -export([check_tcp_listener_address/3]). -export([tcp_listener_started/2, ssl_connection_upgrade/2, - tcp_listener_stopped/2, start_client/1, start_ssl_client/1]). + tcp_listener_stopped/2, start_client/1]). -include("rabbit.hrl"). -include_lib("kernel/include/inet.hrl"). @@ -171,31 +171,26 @@ on_node_down(Node) -> start_client(Sock) -> {ok, Child} = supervisor:start_child(rabbit_tcp_client_sup, []), - ok = gen_tcp:controlling_process(Sock, Child), + ok = rabbit_net:controlling_process(Sock, Child), Child ! {go, Sock}, Child. ssl_connection_upgrade(SslOpts, Sock) -> - {ok, {PeerAddress, PeerPort}} = inet:peername(Sock), + {ok, {PeerAddress, PeerPort}} = rabbit_net:peername(Sock), PeerIp = inet_parse:ntoa(PeerAddress), case ssl:ssl_accept(Sock, SslOpts) of {ok, SslSock} -> error_logger:info_msg("Upgraded TCP connection from ~s:~p to SSL/TLS~n", [PeerIp, PeerPort]), - start_ssl_client(SslSock); + RabbitSslSock = #rabbit_ssl_socket{tcp=Sock, ssl=SslSock}, + start_client(RabbitSslSock); {error, Reason} -> error_logger:error_msg("Failed to upgrade TCP connection from ~s:~p to SSL~n", [PeerIp, PeerPort]), {error, Reason} end. -start_ssl_client(Sock) -> - {ok, {PeerAddress, PeerPort}} = ssl:peername(Sock), - PeerIp = inet_parse:ntoa(PeerAddress), - error_logger:info_msg("Dummy session started for ssl client from ~s:~p~n", - [PeerIp, PeerPort]). - connections() -> [Pid || {_, Pid, _, _} <- supervisor:which_children( rabbit_tcp_client_sup)]. |