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

Comparing AnyEvent/lib/AnyEvent/Handle.pm (file contents):
Revision 1.199 by root, Mon Oct 11 03:41:39 2010 UTC vs.
Revision 1.202 by root, Sat Oct 16 02:01:54 2010 UTC

644=cut 644=cut
645 645
646sub no_delay { 646sub no_delay {
647 $_[0]{no_delay} = $_[1]; 647 $_[0]{no_delay} = $_[1];
648 648
649 eval {
650 local $SIG{__DIE__};
651 setsockopt $_[0]{fh}, Socket::IPPROTO_TCP (), Socket::TCP_NODELAY (), int $_[1] 649 setsockopt $_[0]{fh}, Socket::IPPROTO_TCP (), Socket::TCP_NODELAY (), int $_[1]
652 if $_[0]{fh}; 650 if $_[0]{fh};
653 };
654} 651}
655 652
656=item $handle->keepalive ($boolean) 653=item $handle->keepalive ($boolean)
657 654
658Enables or disables the C<keepalive> setting (see constructor argument of 655Enables or disables the C<keepalive> setting (see constructor argument of
767 $_[0]{$on_timeout} = $_[1]; 764 $_[0]{$on_timeout} = $_[1];
768 }; 765 };
769 766
770 *$timeout = sub { 767 *$timeout = sub {
771 my ($self, $new_value) = @_; 768 my ($self, $new_value) = @_;
769
770 $new_value >= 0
771 or Carp::croak "AnyEvent::Handle->$timeout called with negative timeout ($new_value), caught";
772 772
773 $self->{$timeout} = $new_value; 773 $self->{$timeout} = $new_value;
774 delete $self->{$tw}; &$cb; 774 delete $self->{$tw}; &$cb;
775 }; 775 };
776 776
2006 push @linger, AE::io $fh, 1, sub { 2006 push @linger, AE::io $fh, 1, sub {
2007 my $len = syswrite $fh, $wbuf, length $wbuf; 2007 my $len = syswrite $fh, $wbuf, length $wbuf;
2008 2008
2009 if ($len > 0) { 2009 if ($len > 0) {
2010 substr $wbuf, 0, $len, ""; 2010 substr $wbuf, 0, $len, "";
2011 } else { 2011 } elsif (defined $len || ($! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK)) {
2012 @linger = (); # end 2012 @linger = (); # end
2013 } 2013 }
2014 }; 2014 };
2015 push @linger, AE::timer $linger, 0, sub { 2015 push @linger, AE::timer $linger, 0, sub {
2016 @linger = (); 2016 @linger = ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines