summaryrefslogtreecommitdiff
path: root/src/rabbit_net.erl
diff options
context:
space:
mode:
authorEssien Ita Essien <essiene@gmail.com>2008-12-27 08:09:41 +0100
committerEssien Ita Essien <essiene@gmail.com>2008-12-27 08:09:41 +0100
commit9605e4395594e6a98d4994989757fee9bebac236 (patch)
tree2119b00e92f6687800b2cf204e58e8caa1104b41 /src/rabbit_net.erl
parentfdfa2dfd0487b7261d4e0dae4ba67c7a50f6f3c5 (diff)
downloadrabbitmq-server-9605e4395594e6a98d4994989757fee9bebac236.tar.gz
Rewrite rabbit_net:async_recv according to Matt's suggestion.
Interesting way of shortening the entire story. I like it...!
Diffstat (limited to 'src/rabbit_net.erl')
-rw-r--r--src/rabbit_net.erl14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/rabbit_net.erl b/src/rabbit_net.erl
index 9604d79a..dfa00a6a 100644
--- a/src/rabbit_net.erl
+++ b/src/rabbit_net.erl
@@ -51,16 +51,10 @@ async_recv(Sock, Length, Timeout) when is_record(Sock, ssl_socket) ->
Ref = make_ref(),
- Fun = fun() ->
- case ssl:recv(Sock#ssl_socket.ssl, Length, Timeout) of
- {ok, Data} ->
- Pid ! {inet_async, Sock, Ref, {ok, Data}};
- {error, Reason} ->
- Pid ! {inet_async, Sock, Ref, {error, Reason}}
- end
- end,
-
- spawn(Fun),
+ spawn(fun() -> Pid ! {inet_async, Sock, Ref,
+ ssl:recv(Sock#ssl_socket.ssl, Length, Timeout)}
+ end),
+
{ok, Ref};
async_recv(Sock, Length, Timeout) when is_port(Sock) ->