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.57 by root, Wed Jun 4 11:45:21 2008 UTC vs.
Revision 1.58 by root, Wed Jun 4 22:51:15 2008 UTC

224 if ($self->{tls}) { 224 if ($self->{tls}) {
225 require Net::SSLeay; 225 require Net::SSLeay;
226 $self->starttls (delete $self->{tls}, delete $self->{tls_ctx}); 226 $self->starttls (delete $self->{tls}, delete $self->{tls_ctx});
227 } 227 }
228 228
229# $self->on_eof (delete $self->{on_eof} ) if $self->{on_eof}; # nop
230# $self->on_error (delete $self->{on_error}) if $self->{on_error}; # nop
231# $self->on_read (delete $self->{on_read} ) if $self->{on_read}; # nop
232 $self->on_drain (delete $self->{on_drain}) if $self->{on_drain};
233
234 $self->{_activity} = AnyEvent->now; 229 $self->{_activity} = AnyEvent->now;
235 $self->_timeout; 230 $self->_timeout;
236 231
237 $self->start_read; 232 $self->on_drain (delete $self->{on_drain}) if $self->{on_drain};
233 $self->on_read (delete $self->{on_read} ) if $self->{on_read};
238 234
239 $self 235 $self
240} 236}
241 237
242sub _shutdown { 238sub _shutdown {
686 682
687sub on_read { 683sub on_read {
688 my ($self, $cb) = @_; 684 my ($self, $cb) = @_;
689 685
690 $self->{on_read} = $cb; 686 $self->{on_read} = $cb;
687 $self->_drain_rbuf if $cb;
691} 688}
692 689
693=item $handle->rbuf 690=item $handle->rbuf
694 691
695Returns the read buffer (as a modifiable lvalue). 692Returns the read buffer (as a modifiable lvalue).
1033=item $handle->stop_read 1030=item $handle->stop_read
1034 1031
1035=item $handle->start_read 1032=item $handle->start_read
1036 1033
1037In rare cases you actually do not want to read anything from the 1034In rare cases you actually do not want to read anything from the
1038socket. In this case you can call C<stop_read>. Neither C<on_read> no 1035socket. In this case you can call C<stop_read>. Neither C<on_read> nor
1039any queued callbacks will be executed then. To start reading again, call 1036any queued callbacks will be executed then. To start reading again, call
1040C<start_read>. 1037C<start_read>.
1041 1038
1042Note that AnyEvent::Handle will automatically C<start_read> for you when 1039Note that AnyEvent::Handle will automatically C<start_read> for you when
1043you change the C<on_read> callback or push/unshift a read callback, and it 1040you change the C<on_read> callback or push/unshift a read callback, and it

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines