summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-11-10 18:24:23 +0000
committerSimon MacMullen <simon@rabbitmq.com>2010-11-10 18:24:23 +0000
commiteb71fc4dad6d6c0325e95b2b1b4cfb1b43bcbe9d (patch)
tree77c59ad5bec74ffc4fe44ea872b515d58913b323
parent0b354a73b15fa8f0de0b457eeb7c31952400ffb0 (diff)
downloadrabbitmq-server-eb71fc4dad6d6c0325e95b2b1b4cfb1b43bcbe9d.tar.gz
Keep knowledge of sockets in rabbit_net
-rw-r--r--src/rabbit_net.erl6
-rw-r--r--src/rabbit_reader.erl2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl
index 53d0d5cb..0940dce2 100644
--- a/src/rabbit_net.erl
+++ b/src/rabbit_net.erl
@@ -34,7 +34,7 @@
-export([async_recv/3, close/1, controlling_process/2,
getstat/2, peername/1, peercert/1, port_command/2,
- send/2, sockname/1]).
+ send/2, sockname/1, is_ssl/1]).
%%---------------------------------------------------------------------------
@@ -65,6 +65,7 @@
-spec(sockname/1 ::
(socket())
-> ok_val_or_error({inet:ip_address(), rabbit_networking:ip_port()})).
+-spec(is_ssl/1 :: (socket()) -> boolean()).
-spec(getstat/2 ::
(socket(), [stat_option()])
-> ok_val_or_error([{stat_option(), integer()}])).
@@ -133,3 +134,6 @@ sockname(Sock) when ?IS_SSL(Sock) ->
ssl:sockname(Sock#ssl_socket.ssl);
sockname(Sock) when is_port(Sock) ->
inet:sockname(Sock).
+
+is_ssl(Sock) ->
+ ?IS_SSL(Sock).
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index e0ac6f8f..6017326a 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -840,7 +840,7 @@ i(peer_address, #v1{sock = Sock}) ->
i(peer_port, #v1{sock = Sock}) ->
socket_info(fun rabbit_net:peername/1, fun ({_, P}) -> P end, Sock);
i(ssl, #v1{sock = Sock}) ->
- is_record(Sock, ssl_socket);
+ rabbit_net:is_ssl(Sock);
i(peer_cert_issuer, #v1{sock = Sock}) ->
cert_info(fun rabbit_ssl:peer_cert_issuer/1, Sock);
i(peer_cert_subject, #v1{sock = Sock}) ->