r48239 - in /branches/upstream/libanyevent-perl/current: Changes META.json META.yml README lib/AnyEvent.pm lib/AnyEvent/DNS.pm lib/AnyEvent/Handle.pm lib/AnyEvent/Socket.pm
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sat Dec 5 15:59:28 UTC 2009
Author: jawnsy-guest
Date: Sat Dec 5 15:59:22 2009
New Revision: 48239
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48239
Log:
[svn-upgrade] Integrating new upstream version, libanyevent-perl (5.220)
Modified:
branches/upstream/libanyevent-perl/current/Changes
branches/upstream/libanyevent-perl/current/META.json
branches/upstream/libanyevent-perl/current/META.yml
branches/upstream/libanyevent-perl/current/README
branches/upstream/libanyevent-perl/current/lib/AnyEvent.pm
branches/upstream/libanyevent-perl/current/lib/AnyEvent/DNS.pm
branches/upstream/libanyevent-perl/current/lib/AnyEvent/Handle.pm
branches/upstream/libanyevent-perl/current/lib/AnyEvent/Socket.pm
Modified: branches/upstream/libanyevent-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/Changes?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/Changes (original)
+++ branches/upstream/libanyevent-perl/current/Changes Sat Dec 5 15:59:22 2009
@@ -1,4 +1,18 @@
Revision history for Perl extension AnyEvent.
+
+5.22 Sat Dec 5 03:51:13 CET 2009
+ - downgrade-or-fail in AnyEvent::Handle::push_write, to
+ diagnose encoding failures earlier and more succinctly.
+ (this works around bugs in perl, throwing away encoding info
+ when passing scalar data to extensions).
+ - add more examples to AnyEvent::Socket manpage.
+ - upgrade internal warning set to the same as common::sense 2.03.
+ - use pack "n/a*" for pre-5.8.9 perl compatibility in AnyEvent::DNS
+ (John Beppu).
+ - AnyEvent::Socket::inet_aton now properly supports ipv6, as documented.
+ - add google public dns servers to fallback server set and make sure
+ we load-balance properly between the three sets. also add all
+ fallback dns servers, not just a random one, to each dns config.
5.21 Thu Nov 19 02:48:47 CET 2009
- fix a problem where socket constants were called with parameters
Modified: branches/upstream/libanyevent-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/META.json?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/META.json (original)
+++ branches/upstream/libanyevent-perl/current/META.json Sat Dec 5 15:59:22 2009
@@ -1,1 +1,1 @@
-{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.21","name":"AnyEvent","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{},"recommends":{"Net::SSLeay":1.33,"Guard":1.02,"EV":3.05,"Async::Interrupt":1,"JSON::XS":2.2,"JSON":2.09},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}
+{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.22","name":"AnyEvent","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{},"recommends":{"Net::SSLeay":1.33,"Guard":1.02,"EV":3.05,"Async::Interrupt":1,"JSON::XS":2.2,"JSON":2.09},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}
Modified: branches/upstream/libanyevent-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/META.yml?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/META.yml (original)
+++ branches/upstream/libanyevent-perl/current/META.yml Sat Dec 5 15:59:22 2009
@@ -11,7 +11,7 @@
},
"generated_by" : "ExtUtils::MakeMaker version 6.54",
"distribution_type" : "module",
- "version" : "5.21",
+ "version" : "5.22",
"name" : "AnyEvent",
"author" : [],
"license" : "unknown",
Modified: branches/upstream/libanyevent-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/README?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/README (original)
+++ branches/upstream/libanyevent-perl/current/README Sat Dec 5 15:59:22 2009
@@ -393,6 +393,21 @@
Example: exit on SIGINT
my $w = AnyEvent->signal (signal => "INT", cb => sub { exit 1 });
+
+ Restart Behaviour
+ While restart behaviour is up to the event loop implementation, most
+ will not restart syscalls (that includes Async::Interrupt and AnyEvent's
+ pure perl implementation).
+
+ Safe/Unsafe Signals
+ Perl signals can be either "safe" (synchronous to opcode handling) or
+ "unsafe" (asynchronous) - the former might get delayed indefinitely, the
+ latter might corrupt your memory.
+
+ AnyEvent signal handlers are, in addition, synchronous to the event
+ loop, i.e. they will not interrupt your running perl program but will
+ only be called as part of the normal event handling (just like timer,
+ I/O etc. callbacks, too).
Signal Races, Delays and Workarounds
Many event loops (e.g. Glib, Tk, Qt, IO::Async) do not support attaching
@@ -1711,8 +1726,8 @@
That does not mean that AnyEvent won't take advantage of some additional
modules if they are installed.
- This section epxlains which additional modules will be used, and how
- they affect AnyEvent's operetion.
+ This section explains which additional modules will be used, and how
+ they affect AnyEvent's operation.
Async::Interrupt
This slightly arcane module is used to implement fast signal
@@ -1725,7 +1740,7 @@
If this module is available, then it will be used to implement
signal catching, which means that signals will not be delayed, and
the event loop will not be interrupted regularly, which is more
- efficient (And good for battery life on laptops).
+ efficient (and good for battery life on laptops).
This affects not just the pure-perl event loop, but also other event
loops that have no signal handling on their own (e.g. Glib, Tk, Qt).
@@ -1777,9 +1792,19 @@
because they rely on inefficient but fork-safe "select" or "poll" calls.
Only EV is fully fork-aware.
+ This means that, in general, you cannot fork and do event processing in
+ the child if a watcher was created before the fork (which in turn
+ initialises the event library).
+
If you have to fork, you must either do so *before* creating your first
watcher OR you must not use AnyEvent at all in the child OR you must do
something completely out of the scope of AnyEvent.
+
+ The problem of doing event processing in the parent *and* the child is
+ much more complicated: even for backends that *are* fork-aware or
+ fork-safe, their behaviour is not usually what you want: fork clones all
+ watchers, that means all timers, I/O watchers etc. are active in both
+ parent and child, which is almost never what you want.
SECURITY CONSIDERATIONS
AnyEvent can be forced to load any event model via
Modified: branches/upstream/libanyevent-perl/current/lib/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/lib/AnyEvent.pm?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/lib/AnyEvent.pm (original)
+++ branches/upstream/libanyevent-perl/current/lib/AnyEvent.pm Sat Dec 5 15:59:22 2009
@@ -404,6 +404,23 @@
Example: exit on SIGINT
my $w = AnyEvent->signal (signal => "INT", cb => sub { exit 1 });
+
+=head3 Restart Behaviour
+
+While restart behaviour is up to the event loop implementation, most will
+not restart syscalls (that includes L<Async::Interrupt> and AnyEvent's
+pure perl implementation).
+
+=head3 Safe/Unsafe Signals
+
+Perl signals can be either "safe" (synchronous to opcode handling) or
+"unsafe" (asynchronous) - the former might get delayed indefinitely, the
+latter might corrupt your memory.
+
+AnyEvent signal handlers are, in addition, synchronous to the event loop,
+i.e. they will not interrupt your running perl program but will only be
+called as part of the normal event handling (just like timer, I/O etc.
+callbacks, too).
=head3 Signal Races, Delays and Workarounds
@@ -1116,7 +1133,7 @@
# basically a tuned-down version of common::sense
sub common_sense {
# from common:.sense 1.0
- ${^WARNING_BITS} = "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03";
+ ${^WARNING_BITS} = "\xfc\x3f\x33\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03";
# use strict vars subs
$^H |= 0x00000600;
}
@@ -1125,7 +1142,7 @@
use Carp ();
-our $VERSION = '5.21';
+our $VERSION = '5.22';
our $MODEL;
our $AUTOLOAD;
@@ -2433,8 +2450,8 @@
That does not mean that AnyEvent won't take advantage of some additional
modules if they are installed.
-This section epxlains which additional modules will be used, and how they
-affect AnyEvent's operetion.
+This section explains which additional modules will be used, and how they
+affect AnyEvent's operation.
=over 4
@@ -2449,7 +2466,7 @@
If this module is available, then it will be used to implement signal
catching, which means that signals will not be delayed, and the event loop
-will not be interrupted regularly, which is more efficient (And good for
+will not be interrupted regularly, which is more efficient (and good for
battery life on laptops).
This affects not just the pure-perl event loop, but also other event loops
@@ -2509,9 +2526,19 @@
because they rely on inefficient but fork-safe C<select> or C<poll>
calls. Only L<EV> is fully fork-aware.
+This means that, in general, you cannot fork and do event processing
+in the child if a watcher was created before the fork (which in turn
+initialises the event library).
+
If you have to fork, you must either do so I<before> creating your first
watcher OR you must not use AnyEvent at all in the child OR you must do
something completely out of the scope of AnyEvent.
+
+The problem of doing event processing in the parent I<and> the child
+is much more complicated: even for backends that I<are> fork-aware or
+fork-safe, their behaviour is not usually what you want: fork clones all
+watchers, that means all timers, I/O watchers etc. are active in both
+parent and child, which is almost never what you want.
=head1 SECURITY CONSIDERATIONS
Modified: branches/upstream/libanyevent-perl/current/lib/AnyEvent/DNS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/lib/AnyEvent/DNS.pm?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/lib/AnyEvent/DNS.pm (original)
+++ branches/upstream/libanyevent-perl/current/lib/AnyEvent/DNS.pm Sat Dec 5 15:59:22 2009
@@ -38,9 +38,11 @@
# some public dns servers
our @DNS_FALLBACK = (
- v209.244.0.3, v209.244.0.4, # level3
- v4.2.2.1, v4.2.2.3, v4.2.2.4, v4.2.2.5, v4.2.2.6, # vnsc-pri.sys.gtei.net
+ (v8.8.8.8, v8.8.4.4)[rand 2], # google public dns
+ (v209.244.0.3, v209.244.0.4)[rand 2], # level3
+ (v4.2.2.1, v4.2.2.3, v4.2.2.4, v4.2.2.5, v4.2.2.6)[rand 4], # vnsc-pri.sys.gtei.net
);
+push @DNS_FALLBACK, splice @DNS_FALLBACK, rand $_, 1 for reverse 1.. at DNS_FALLBACK;
=item AnyEvent::DNS::a $domain, $cb->(@addrs)
@@ -938,8 +940,8 @@
}
}
- # always add one fallback server
- push @{ $self->{server} }, $DNS_FALLBACK[rand @DNS_FALLBACK];
+ # always add the fallback servers
+ push @{ $self->{server} }, @DNS_FALLBACK;
$self->_compile;
} else {
@@ -1091,7 +1093,7 @@
&$do_retry;
};
- $handle->push_write (pack "n/a", $req->[0]);
+ $handle->push_write (pack "n/a*", $req->[0]);
$handle->push_read (chunk => 2, sub {
$handle->unshift_read (chunk => (unpack "n", $_[1]), sub {
undef $handle;
Modified: branches/upstream/libanyevent-perl/current/lib/AnyEvent/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/lib/AnyEvent/Handle.pm?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/lib/AnyEvent/Handle.pm (original)
+++ branches/upstream/libanyevent-perl/current/lib/AnyEvent/Handle.pm Sat Dec 5 15:59:22 2009
@@ -905,11 +905,14 @@
->($self, @_);
}
+ # we downgrade here to avoid hard-to-track-down bugs,
+ # and diagnose the problem earlier and better.
+
if ($self->{tls}) {
- $self->{_tls_wbuf} .= $_[0];
+ utf8::downgrade $self->{_tls_wbuf} .= $_[0];
&_dotls ($self) if $self->{fh};
} else {
- $self->{wbuf} .= $_[0];
+ utf8::downgrade $self->{wbuf} .= $_[0];
$self->_drain_wbuf if $self->{fh};
}
}
Modified: branches/upstream/libanyevent-perl/current/lib/AnyEvent/Socket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libanyevent-perl/current/lib/AnyEvent/Socket.pm?rev=48239&op=diff
==============================================================================
--- branches/upstream/libanyevent-perl/current/lib/AnyEvent/Socket.pm (original)
+++ branches/upstream/libanyevent-perl/current/lib/AnyEvent/Socket.pm Sat Dec 5 15:59:22 2009
@@ -111,6 +111,11 @@
This function works similarly to C<inet_pton AF_INET6, ...>.
+Example:
+
+ print unpack "H*", parse_ipv6 "2002:5345::10.0.0.1";
+ # => 2002534500000000000000000a000001
+
=cut
sub parse_ipv6($) {
@@ -170,6 +175,11 @@
If the C<$text> to parse is a mapped IPv4 in IPv6 address (:ffff::<ipv4>),
then it will be treated as an IPv4 address. If you don't want that, you
have to call C<parse_ipv4> and/or C<parse_ipv6> manually.
+
+Example:
+
+ print unpack "H*", parse_address "10.1.2.3";
+ # => 0a010203
=item $ipn = AnyEvent::Socket::aton $ip
@@ -197,6 +207,10 @@
work even on broken platforms (well, that's windows), where getprotobyname
is traditionally very unreliable.
+Example: get the protocol number for TCP (usually 6)
+
+ my $proto = getprotobyname "tcp";
+
=cut
# microsoft can't even get getprotobyname working (the etc/protocols file
@@ -352,6 +366,11 @@
If the C<$ipn> is a mapped IPv4 in IPv6 address (:ffff::<ipv4>), then just
the contained IPv4 address will be returned. If you do not want that, you
have to call C<format_ipv6> manually.
+
+Example:
+
+ print format_address "\x01\x02\x03\x05";
+ => 1.2.3.5
=item $text = AnyEvent::Socket::ntoa $ipn
@@ -413,12 +432,27 @@
=item inet_aton $name_or_address, $cb->(@addresses)
Works similarly to its Socket counterpart, except that it uses a
-callback. Also, if a host has only an IPv6 address, this might be passed
-to the callback instead (use the length to detect this - 4 for IPv4, 16
-for IPv6).
-
-Unlike the L<Socket> function of the same name, you can get multiple IPv4
-and IPv6 addresses as result (and maybe even other adrdess types).
+callback. Use the length to distinguish between ipv4 and ipv6 (4 octets
+for IPv4, 16 for IPv6), or use C<format_address> to convert it to a more
+readable format.
+
+Note that C<resolve_sockaddr>, while initially a more complex interface,
+resolves host addresses, service names and SRV records and gives you an
+ordered list of socket addresses to try and should be preferred over
+C<inet_aton>.
+
+Example.
+
+ inet_aton "www.google.com", my $cv = AE::cv;
+ say unpack "H*", $_
+ for $cv->recv;
+ # => d155e363
+ # => d155e367 etc.
+
+ inet_aton "ipv6.google.com", my $cv = AE::cv;
+ say unpack "H*", $_
+ for $cv->recv;
+ # => 20014860a00300000000000000000068
=cut
@@ -434,15 +468,34 @@
} else {
require AnyEvent::DNS;
- # simple, bad suboptimal algorithm
- AnyEvent::DNS::a ($name, sub {
- if (@_) {
- $cb->(map +(parse_ipv4 $_), @_);
- } else {
- $cb->();
- #AnyEvent::DNS::aaaa ($name, $cb); need inet_pton
- }
- });
+ my $ipv4 = $AnyEvent::PROTOCOL{ipv4};
+ my $ipv6 = $AnyEvent::PROTOCOL{ipv6};
+
+ my @res;
+
+ my $cv = AE::cv {
+ $cb->(map @$_, reverse @res);
+ };
+
+ $cv->begin;
+
+ if ($ipv4) {
+ $cv->begin;
+ AnyEvent::DNS::a ($name, sub {
+ $res[$ipv4] = [map &parse_ipv4, @_];
+ $cv->end;
+ });
+ };
+
+ if ($ipv6) {
+ $cv->begin;
+ AnyEvent::DNS::aaaa ($name, sub {
+ $res[$ipv6] = [map &parse_ipv6, @_];
+ $cv->end;
+ });
+ };
+
+ $cv->end;
}
}
@@ -456,7 +509,7 @@
: sub { unpack "S" , $_[0] };
}
-# check for broken platforms with extra field in sockaddr structure
+# check for broken platforms with an extra field in sockaddr structure
# kind of a rfc vs. bsd issue, as usual (ok, normally it's a
# unix vs. bsd issue, a iso C vs. bsd issue or simply a
# correctness vs. bsd issue.)
@@ -469,6 +522,12 @@
structure. Handles both IPv4 and IPv6 host addresses, as well as UNIX
domain sockets (C<$host> == C<unix/> and C<$service> == absolute
pathname).
+
+Example:
+
+ my $bind = AnyEvent::Socket::pack_sockaddr 43, v195.234.53.120;
+ bind $socket, $bind
+ or die "bind: $!";
=cut
More information about the Pkg-perl-cvs-commits
mailing list