Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Transplant of bug25157
Browse files Browse the repository at this point in the history
  • Loading branch information
Emile Joubert committed Sep 25, 2012
1 parent 7877277 commit 8a562e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ebin/amqp_client.app.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{vsn, "%%VSN%%"},
{modules, []},
{registered, [amqp_sup]},
{env, []},
{env, [{prefer_ipv6, false}]},
{mod, {amqp_client, []}},
{applications, [kernel, stdlib]}]}.
9 changes: 7 additions & 2 deletions src/amqp_network_connection.erl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
-include("amqp_client.hrl").

-behaviour(amqp_gen_connection).

-export([init/1, terminate/2, connect/4, do/2, open_channel_args/1, i/2,
info_keys/0, handle_message/2, closing/3, channels_terminated/1]).

Expand Down Expand Up @@ -149,9 +148,15 @@ do_connect({Addr, Family},
E
end.

inet_address_preference() ->
case application:get_env(amqp_client, prefer_ipv6) of
{ok, true} -> [inet6, inet];
{ok, false} -> [inet, inet6]
end.

gethostaddr(Host) ->
Lookups = [{Family, inet:getaddr(Host, Family)}
|| Family <- [inet, inet6]],
|| Family <- inet_address_preference()],
[{IP, Family} || {Family, {ok, IP}} <- Lookups].

try_handshake(AmqpParams, SIF, ChMgr, State) ->
Expand Down

0 comments on commit 8a562e0

Please sign in to comment.