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.212 by root, Fri Dec 31 04:50:44 2010 UTC vs.
Revision 1.214 by root, Sun Jan 16 17:12:27 2011 UTC

1087before it was actually written. One way to do that is to replace your 1087before it was actually written. One way to do that is to replace your
1088C<on_drain> handler by a callback that shuts down the socket (and set 1088C<on_drain> handler by a callback that shuts down the socket (and set
1089C<low_water_mark> to C<0>). This method is a shorthand for just that, and 1089C<low_water_mark> to C<0>). This method is a shorthand for just that, and
1090replaces the C<on_drain> callback with: 1090replaces the C<on_drain> callback with:
1091 1091
1092 sub { shutdown $_[0]{fh}, 1 } # for push_shutdown 1092 sub { shutdown $_[0]{fh}, 1 }
1093 1093
1094This simply shuts down the write side and signals an EOF condition to the 1094This simply shuts down the write side and signals an EOF condition to the
1095the peer. 1095the peer.
1096 1096
1097You can rely on the normal read queue and C<on_eof> handling 1097You can rely on the normal read queue and C<on_eof> handling
1773Note that AnyEvent::Handle will automatically C<start_read> for you when 1773Note that AnyEvent::Handle will automatically C<start_read> for you when
1774you change the C<on_read> callback or push/unshift a read callback, and it 1774you change the C<on_read> callback or push/unshift a read callback, and it
1775will automatically C<stop_read> for you when neither C<on_read> is set nor 1775will automatically C<stop_read> for you when neither C<on_read> is set nor
1776there are any read requests in the queue. 1776there are any read requests in the queue.
1777 1777
1778These methods will have no effect when in TLS mode (as TLS doesn't support 1778In older versions of this module (<= 5.3), these methods had no effect,
1779half-duplex connections). 1779as TLS does not support half-duplex connections. In current versions they
1780work as expected, as this behaviour is required to avoid certain resource
1781attacks, where the program would be forced to read (and buffer) arbitrary
1782amounts of data before being able to send some data. The drawback is that
1783some readings of the the SSL/TLS specifications basically require this
1784attack to be working, as SSL/TLS implementations might stall sending data
1785during a rehandshake.
1786
1787As a guideline, during the initial handshake, you should not stop reading,
1788and as a client, it might cause problems, depending on your applciation.
1780 1789
1781=cut 1790=cut
1782 1791
1783sub stop_read { 1792sub stop_read {
1784 my ($self) = @_; 1793 my ($self) = @_;
1785 1794
1786 delete $self->{_rw} unless $self->{tls}; 1795 delete $self->{_rw};
1787} 1796}
1788 1797
1789sub start_read { 1798sub start_read {
1790 my ($self) = @_; 1799 my ($self) = @_;
1791 1800

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines