[libanyevent-handle-udp-perl] 50/60: Allow EINTR in recv

Jonas Smedegaard js at alioth.debian.org
Mon Sep 30 10:05:46 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 29c845b3d377eda3967958c3351d0241230eb990
Author: Leon Timmermans <fawaka at gmail.com>
Date:   Wed Sep 4 12:56:21 2013 +0200

    Allow EINTR in recv
---
 Changes                    |    1 +
 lib/AnyEvent/Handle/UDP.pm |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Changes b/Changes
index a14d845..30de33a 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,7 @@ Revision history for AnyEvent-Handle-UDP
 
 {{$NEXT}}
           Require Moo 1.001000
+          Allow EINTR in recv
 
 0.041     2013-09-01 12:02:03 Europe/Amsterdam
           Handle address reuse better
diff --git a/lib/AnyEvent/Handle/UDP.pm b/lib/AnyEvent/Handle/UDP.pm
index 962d04b..99b56ea 100644
--- a/lib/AnyEvent/Handle/UDP.pm
+++ b/lib/AnyEvent/Handle/UDP.pm
@@ -54,6 +54,8 @@ has _reader => (
 	init_arg => undef,
 );
 
+my %non_fatal = map { ( $_ => 1 ) } EAGAIN, EWOULDBLOCK, EINTR;
+
 sub _build__reader {
 	my $self = shift;
 	return AE::io($self->fh, 0, sub {
@@ -62,7 +64,7 @@ sub _build__reader {
 			$self->rtimeout_reset;
 			$self->on_recv->($buffer, $self, $addr);
 		}
-		$self->_error(1, "Couldn't recv: $!") if $! != EAGAIN and $! != EWOULDBLOCK;
+		$self->_error(1, "Couldn't recv: $!") if not $non_fatal{$! + 0};
 		return;
 	});
 }
@@ -287,8 +289,6 @@ sub _error {
 	return;
 }
 
-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;

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