… | |
… | |
1773 | Note that AnyEvent::Handle will automatically C<start_read> for you when |
1773 | Note that AnyEvent::Handle will automatically C<start_read> for you when |
1774 | you change the C<on_read> callback or push/unshift a read callback, and it |
1774 | you change the C<on_read> callback or push/unshift a read callback, and it |
1775 | will automatically C<stop_read> for you when neither C<on_read> is set nor |
1775 | will automatically C<stop_read> for you when neither C<on_read> is set nor |
1776 | there are any read requests in the queue. |
1776 | there are any read requests in the queue. |
1777 | |
1777 | |
1778 | These methods will have no effect when in TLS mode (as TLS doesn't support |
1778 | In older versions of this module (<= 5.3), these methods had no effect, |
1779 | half-duplex connections). |
1779 | as TLS does not support half-duplex connections. In current versions they |
|
|
1780 | work as expected, as this behaviour is required to avoid certain resource |
|
|
1781 | attacks, where the program would be forced to read (and buffer) arbitrary |
|
|
1782 | amounts of data before being able to send some data. The drawback is that |
|
|
1783 | some readings of the the SSL/TLS specifications basically require this |
|
|
1784 | attack to be working, as SSL/TLS implementations might stall sending data |
|
|
1785 | during a rehandshake. |
|
|
1786 | |
|
|
1787 | As a guideline, during the initial handshake, you should not stop reading, |
|
|
1788 | and as a client, it might cause problems, depending on your applciation. |
1780 | |
1789 | |
1781 | =cut |
1790 | =cut |
1782 | |
1791 | |
1783 | sub stop_read { |
1792 | sub 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 | |
1789 | sub start_read { |
1798 | sub start_read { |
1790 | my ($self) = @_; |
1799 | my ($self) = @_; |
1791 | |
1800 | |