ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Socket.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Socket.pm (file contents):
Revision 1.130 by root, Fri Jan 14 17:43:11 2011 UTC vs.
Revision 1.131 by root, Thu Aug 11 20:56:07 2011 UTC

57 tcp_server 57 tcp_server
58 tcp_connect 58 tcp_connect
59); 59);
60 60
61our $VERSION = $AnyEvent::VERSION; 61our $VERSION = $AnyEvent::VERSION;
62
63# used in cases where we may return immediately but want the
64# caller to do stuff first
65sub _postpone {
66 my ($cb, @args) = (@_, $!);
67
68 my $w; $w = AE::timer 0, 0, sub {
69 undef $w;
70 $! = pop @args;
71 $cb->(@args);
72 };
73}
74 62
75=item $ipn = parse_ipv4 $dotted_quad 63=item $ipn = parse_ipv4 $dotted_quad
76 64
77Tries to parse the given dotted quad IPv4 address and return it in 65Tries to parse the given dotted quad IPv4 address and return it in
78octet form (or undef when it isn't in a parsable format). Supports all 66octet form (or undef when it isn't in a parsable format). Supports all
896 884
897 $state{next} = sub { 885 $state{next} = sub {
898 return unless exists $state{fh}; 886 return unless exists $state{fh};
899 887
900 my $target = shift @target 888 my $target = shift @target
901 or return _postpone sub { 889 or return AnyEvent::postpone {
902 return unless exists $state{fh}; 890 return unless exists $state{fh};
903 %state = (); 891 %state = ();
904 $connect->(); 892 $connect->();
905 }; 893 };
906 894

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines