[libanyevent-handle-udp-perl] 32/60: Handle absence of IPv6 better (hopefully)

Jonas Smedegaard js at alioth.debian.org
Mon Sep 30 10:05:42 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libanyevent-handle-udp-perl.

commit 503a4b6795586d51d4e28290aba3844b681e9844
Author: Leon Timmermans <fawaka at gmail.com>
Date:   Thu Nov 15 00:27:41 2012 +0100

    Handle absence of IPv6 better (hopefully)
---
 Changes                    |    1 +
 lib/AnyEvent/Handle/UDP.pm |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index d649406..6c70bb4 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for AnyEvent-Handle-UDP
 
 {{$NEXT}}
+          Handle absence of IPv6 better (hopefully)
 
 0.036     2012-06-06 19:23:18 Europe/Amsterdam
           Make fh an IO::Socket object
diff --git a/lib/AnyEvent/Handle/UDP.pm b/lib/AnyEvent/Handle/UDP.pm
index 45bce2c..89fe485 100644
--- a/lib/AnyEvent/Handle/UDP.pm
+++ b/lib/AnyEvent/Handle/UDP.pm
@@ -11,7 +11,8 @@ use AnyEvent::Socket qw/parse_address/;
 use Carp qw/croak/;
 use Errno qw/EAGAIN EWOULDBLOCK EINTR ETIMEDOUT/;
 use Scalar::Util qw/reftype looks_like_number weaken openhandle/;
-use Socket qw/SOL_SOCKET SO_REUSEADDR SOCK_DGRAM INADDR_ANY AF_INET AF_INET6 sockaddr_family/;
+use Socket qw/SOL_SOCKET SO_REUSEADDR SOCK_DGRAM INADDR_ANY AF_INET sockaddr_family/;
+BEGIN { *AF_INET6 = defined &Socket::AF_INET6 ? \&Socket::AF_INET6 : sub () { -1 } }
 use Symbol qw/gensym/;
 
 BEGIN {
@@ -283,7 +284,7 @@ my %non_fatal = map { ( $_ => 1 ) } EAGAIN, EWOULDBLOCK, EINTR;
 sub push_send {
 	my ($self, $message, $to, $cv) = @_;
 	$to = AnyEvent::Socket::pack_sockaddr($to->[1], defined $to->[0] ? parse_address($to->[0]) : INADDR_ANY) if ref $to;
-	$cv ||= defined wantarray ? AnyEvent::CondVar->new : undef;
+	$cv ||= AnyEvent::CondVar->new if defined wantarray;
 	if ($self->autoflush and ! @{ $self->_buffers }) {
 		my $ret = $self->_send($message, $to, $cv);
 		$self->_push_writer($message, $to, $cv) if not defined $ret and $non_fatal{$! + 0};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-handle-udp-perl.git



More information about the Pkg-perl-cvs-commits mailing list