[libanyevent-handle-udp-perl] 19/60: Accept undef address as INADR_ANY

Jonas Smedegaard js at alioth.debian.org
Mon Sep 30 10:05:39 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 acd96fd96278f0b0f53bf02302228ba4b412c7a2
Author: Leon Timmermans <fawaka at gmail.com>
Date:   Sun Apr 29 23:07:49 2012 +0200

    Accept undef address as INADR_ANY
---
 lib/AnyEvent/Handle/UDP.pm |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/AnyEvent/Handle/UDP.pm b/lib/AnyEvent/Handle/UDP.pm
index 28889c1..56fa812 100644
--- a/lib/AnyEvent/Handle/UDP.pm
+++ b/lib/AnyEvent/Handle/UDP.pm
@@ -6,13 +6,13 @@ use Moo;
 
 use AnyEvent qw//;
 use AnyEvent::Util qw/fh_nonblocking/;
-use AnyEvent::Socket qw//;
+use AnyEvent::Socket qw/parse_address/;
 
 use Carp qw/croak/;
 use Const::Fast qw/const/;
 use Errno qw/EAGAIN EWOULDBLOCK EINTR/;
 use Scalar::Util qw/reftype looks_like_number/;
-use Socket qw/SOL_SOCKET SO_REUSEADDR SOCK_DGRAM/;
+use Socket qw/SOL_SOCKET SO_REUSEADDR SOCK_DGRAM INADDR_ANY/;
 use Symbol qw/gensym/;
 
 use namespace::clean;
@@ -176,7 +176,7 @@ my %non_fatal = map { ( $_ => 1 ) } EAGAIN, EWOULDBLOCK, EINTR;
 
 sub push_send {
 	my ($self, $message, $to, $cv) = @_;
-	$to = AnyEvent::Socket::pack_sockaddr($to->[0], AnyEvent::Socket::parse_address($to->[1])) if ref $to;
+	$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;
 	if ($self->autoflush and ! @{ $self->{buffers} }) {
 		my $ret = $self->_send($message, $to, $cv);
@@ -192,7 +192,7 @@ sub push_send {
 sub _send {
 	my ($self, $message, $to, $cv) = @_;
 	my $ret = defined $to ? send $self->{fh}, $message, 0, $to : send $self->{fh}, $message, 0;
-	$self->on_error->($self->{fh}, 1, "$!") if not defined $ret and !$non_fatal{$! + 0};
+	$self->_error(1, "$!") if not defined $ret and !$non_fatal{$! + 0};
 	$cv->($ret) if defined $cv and defined $ret;
 	return $ret;
 }

-- 
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