… | |
… | |
133 | and no read request is in the queue (unlike read queue callbacks, this |
133 | and no read request is in the queue (unlike read queue callbacks, this |
134 | callback will only be called when at least one octet of data is in the |
134 | callback will only be called when at least one octet of data is in the |
135 | read buffer). |
135 | read buffer). |
136 | |
136 | |
137 | To access (and remove data from) the read buffer, use the C<< ->rbuf >> |
137 | To access (and remove data from) the read buffer, use the C<< ->rbuf >> |
138 | method or access the C<$handle->{rbuf}> member directly. Note that you |
138 | method or access the C<< $handle->{rbuf} >> member directly. Note that you |
139 | must not enlarge or modify the read buffer, you can only remove data at |
139 | must not enlarge or modify the read buffer, you can only remove data at |
140 | the beginning from it. |
140 | the beginning from it. |
141 | |
141 | |
142 | When an EOF condition is detected then AnyEvent::Handle will first try to |
142 | When an EOF condition is detected then AnyEvent::Handle will first try to |
143 | feed all the remaining data to the queued callbacks and C<on_read> before |
143 | feed all the remaining data to the queued callbacks and C<on_read> before |
… | |
… | |
249 | |
249 | |
250 | A string used to identify the remote site - usually the DNS hostname |
250 | A string used to identify the remote site - usually the DNS hostname |
251 | (I<not> IDN!) used to create the connection, rarely the IP address. |
251 | (I<not> IDN!) used to create the connection, rarely the IP address. |
252 | |
252 | |
253 | Apart from being useful in error messages, this string is also used in TLS |
253 | Apart from being useful in error messages, this string is also used in TLS |
254 | common name verification (see C<verify_cn> in L<AnyEvent::TLS>). |
254 | peername verification (see C<verify_peername> in L<AnyEvent::TLS>). |
255 | |
255 | |
256 | =item tls => "accept" | "connect" | Net::SSLeay::SSL object |
256 | =item tls => "accept" | "connect" | Net::SSLeay::SSL object |
257 | |
257 | |
258 | When this parameter is given, it enables TLS (SSL) mode, that means |
258 | When this parameter is given, it enables TLS (SSL) mode, that means |
259 | AnyEvent will start a TLS handshake as soon as the conenction has been |
259 | AnyEvent will start a TLS handshake as soon as the conenction has been |
… | |
… | |
856 | |
856 | |
857 | if ($self->{_eof}) { |
857 | if ($self->{_eof}) { |
858 | if ($self->{on_eof}) { |
858 | if ($self->{on_eof}) { |
859 | $self->{on_eof}($self) |
859 | $self->{on_eof}($self) |
860 | } else { |
860 | } else { |
861 | $self->_error (0, 1); |
861 | $self->_error (0, 1, "Unexpected end-of-file"); |
862 | } |
862 | } |
863 | } |
863 | } |
864 | |
864 | |
865 | # may need to restart read watcher |
865 | # may need to restart read watcher |
866 | unless ($self->{_rw}) { |
866 | unless ($self->{_rw}) { |
… | |
… | |
1586 | } |
1586 | } |
1587 | |
1587 | |
1588 | =item $handle->destroy |
1588 | =item $handle->destroy |
1589 | |
1589 | |
1590 | Shuts down the handle object as much as possible - this call ensures that |
1590 | Shuts down the handle object as much as possible - this call ensures that |
1591 | no further callbacks will be invoked and resources will be freed as much |
1591 | no further callbacks will be invoked and as many resources as possible |
1592 | as possible. You must not call any methods on the object afterwards. |
1592 | will be freed. You must not call any methods on the object afterwards. |
1593 | |
1593 | |
1594 | Normally, you can just "forget" any references to an AnyEvent::Handle |
1594 | Normally, you can just "forget" any references to an AnyEvent::Handle |
1595 | object and it will simply shut down. This works in fatal error and EOF |
1595 | object and it will simply shut down. This works in fatal error and EOF |
1596 | callbacks, as well as code outside. It does I<NOT> work in a read or write |
1596 | callbacks, as well as code outside. It does I<NOT> work in a read or write |
1597 | callback, so when you want to destroy the AnyEvent::Handle object from |
1597 | callback, so when you want to destroy the AnyEvent::Handle object from |