summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-04-25 14:13:48 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-04-25 14:13:48 +0100
commit0f0a66e7dc5fbf4b1763b90b89b9efe56d0e60ad (patch)
tree58402a6f512cb4dcdabd74dfdb55533442ef5635
parente4101968e294aacd0f673bc0118f4d64240cc09a (diff)
parentb69d00ed8e9de3860c1e5c2d8d56a5853c64edc5 (diff)
downloadrabbitmq-server-0f0a66e7dc5fbf4b1763b90b89b9efe56d0e60ad.tar.gz
stable to default
-rw-r--r--src/rabbit_net.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl
index b53c16bf..b7f4d019 100644
--- a/src/rabbit_net.erl
+++ b/src/rabbit_net.erl
@@ -18,9 +18,9 @@
-include("rabbit.hrl").
-export([is_ssl/1, ssl_info/1, controlling_process/2, getstat/2,
- recv/1, async_recv/3, port_command/2, getopts/2, setopts/2, send/2,
- close/1, fast_close/1, sockname/1, peername/1, peercert/1,
- connection_string/2, socket_ends/2]).
+ recv/1, sync_recv/2, async_recv/3, port_command/2, getopts/2,
+ setopts/2, send/2, close/1, fast_close/1, sockname/1, peername/1,
+ peercert/1, connection_string/2, socket_ends/2]).
%%---------------------------------------------------------------------------
@@ -48,6 +48,8 @@
-spec(recv/1 :: (socket()) ->
{'data', [char()] | binary()} | 'closed' |
rabbit_types:error(any()) | {'other', any()}).
+-spec(sync_recv/2 :: (socket(), integer()) -> rabbit_types:ok(binary()) |
+ rabbit_types:error(any())).
-spec(async_recv/3 ::
(socket(), integer(), timeout()) -> rabbit_types:ok(any())).
-spec(port_command/2 :: (socket(), iolist()) -> 'true').
@@ -114,6 +116,11 @@ recv(S, {DataTag, ClosedTag, ErrorTag}) ->
Other -> {other, Other}
end.
+sync_recv(Sock, Length) when ?IS_SSL(Sock) ->
+ ssl:recv(Sock#ssl_socket.ssl, Length);
+sync_recv(Sock, Length) ->
+ gen_tcp:recv(Sock, Length).
+
async_recv(Sock, Length, Timeout) when ?IS_SSL(Sock) ->
Pid = self(),
Ref = make_ref(),