Skip to content

Commit

Permalink
Don't confess on the use of AF_INET6 or PF_INET6 in SocketFactory.
Browse files Browse the repository at this point in the history
SocketFactory uses those constants unconditionally during
initialization, so things that don't even need them fail.

http://www.cpantesters.org/cpan/report/9c1ad42e-12dc-11e2-81a5-a3382b22a531
is a Perl 5.6.2 test failure, but as far as I can tell all the errors
are due to missing IPv6 support on that platform.
  • Loading branch information
rcaputo committed Oct 11, 2012
1 parent d8eec52 commit ec43fcd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/POE/Wheel/SocketFactory.pm
Expand Up @@ -62,8 +62,8 @@ BEGIN {
# :newapi is legacy, but we include it to be sure in case the user has an old version of GAI
eval { require Socket::GetAddrInfo; Socket::GetAddrInfo->import( qw(:newapi getaddrinfo getnameinfo) ) };
if ($@) {
*getaddrinfo = sub { Carp::confess("Unable to use IPv6: Socket::GetAddrInfo not available") };
*getnameinfo = sub { Carp::confess("Unable to use IPv6: Socket::GetAddrInfo not available") };
*getaddrinfo = sub { Carp::confess("Unable to use IPv6: Neither Socket nor Socket::GetAddrInfo provides getaddrinfo()") };
*getnameinfo = sub { Carp::confess("Unable to use IPv6: Neither Socket nor Socket::GetAddrInfo provides getnameinfo()") };
}
}

Expand All @@ -72,8 +72,8 @@ BEGIN {
if ($@) {
eval { require Socket6; Socket6->import( qw(AF_INET6 PF_INET6) ) };
if ($@) {
*AF_INET6 = sub { Carp::confess("Unable to use IPv6: Socket6 not available") };
*PF_INET6 = sub { Carp::confess("Unable to use IPv6: Socket6 not available") };
*AF_INET6 = sub { -1 };
*PF_INET6 = sub { -1 };
}
}
}
Expand Down Expand Up @@ -509,7 +509,11 @@ sub new {
my $abstract_domain = $map_family_to_domain{$self->[MY_SOCKET_DOMAIN]};
unless (defined $abstract_domain) {
$poe_kernel->yield(
$event_failure, 'domain', 0, '', $self->[MY_UNIQUE_ID]
$event_failure,
'domain',
0,
"SocketDomain $domain is currently unsupported on this platform",
$self->[MY_UNIQUE_ID]
);
return $self;
}
Expand Down

0 comments on commit ec43fcd

Please sign in to comment.