From e206de15f29e52feda7a7ace73fb5f3adbdee640 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Wed, 15 Aug 2012 12:48:15 +0100 Subject: [PATCH] Backport bug 24953 (Erlang client should use fhc when running in the same VM as rabbit) --- src/amqp_network_connection.erl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amqp_network_connection.erl b/src/amqp_network_connection.erl index 3115f692..0cb799e9 100644 --- a/src/amqp_network_connection.erl +++ b/src/amqp_network_connection.erl @@ -117,6 +117,7 @@ do_connect({Addr, Family}, connection_timeout = Timeout, socket_options = ExtraOpts}, SIF, ChMgr, State) -> + obtain(), case gen_tcp:connect(Addr, Port, [Family | ?RABBIT_TCP_OPTS] ++ ExtraOpts, Timeout) of @@ -131,6 +132,7 @@ do_connect({Addr, Family}, socket_options = ExtraOpts}, SIF, ChMgr, State) -> rabbit_misc:start_applications([crypto, public_key, ssl]), + obtain(), case gen_tcp:connect(Addr, Port, [Family | ?RABBIT_TCP_OPTS] ++ ExtraOpts, Timeout) of @@ -306,3 +308,9 @@ handshake_recv(Expecting) -> exit(handshake_receive_timed_out) end end. + +obtain() -> + case code:is_loaded(file_handle_cache) of + false -> ok; + _ -> file_handle_cache:obtain() + end.