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.217 by root, Thu Feb 3 00:29:33 2011 UTC vs.
Revision 1.218 by root, Thu Feb 24 12:04:20 2011 UTC

247many seconds pass without a successful read or write on the underlying 247many seconds pass without a successful read or write on the underlying
248file handle (or a call to C<timeout_reset>), the C<on_timeout> callback 248file handle (or a call to C<timeout_reset>), the C<on_timeout> callback
249will be invoked (and if that one is missing, a non-fatal C<ETIMEDOUT> 249will be invoked (and if that one is missing, a non-fatal C<ETIMEDOUT>
250error will be raised). 250error will be raised).
251 251
252There are three variants of the timeouts that work independently 252There are three variants of the timeouts that work independently of each
253of each other, for both read and write, just read, and just write: 253other, for both read and write (triggered when nothing was read I<OR>
254written), just read (triggered when nothing was read), and just write:
254C<timeout>, C<rtimeout> and C<wtimeout>, with corresponding callbacks 255C<timeout>, C<rtimeout> and C<wtimeout>, with corresponding callbacks
255C<on_timeout>, C<on_rtimeout> and C<on_wtimeout>, and reset functions 256C<on_timeout>, C<on_rtimeout> and C<on_wtimeout>, and reset functions
256C<timeout_reset>, C<rtimeout_reset>, and C<wtimeout_reset>. 257C<timeout_reset>, C<rtimeout_reset>, and C<wtimeout_reset>.
257 258
258Note that timeout processing is active even when you do not have 259Note that timeout processing is active even when you do not have any
259any outstanding read or write requests: If you plan to keep the connection 260outstanding read or write requests: If you plan to keep the connection
260idle then you should disable the timeout temporarily or ignore the timeout 261idle then you should disable the timeout temporarily or ignore the
261in the C<on_timeout> callback, in which case AnyEvent::Handle will simply 262timeout in the corresponding C<on_timeout> callback, in which case
262restart the timeout. 263AnyEvent::Handle will simply restart the timeout.
263 264
264Zero (the default) disables this timeout. 265Zero (the default) disables the corresponding timeout.
265 266
266=item on_timeout => $cb->($handle) 267=item on_timeout => $cb->($handle)
268
269=item on_rtimeout => $cb->($handle)
270
271=item on_wtimeout => $cb->($handle)
267 272
268Called whenever the inactivity timeout passes. If you return from this 273Called whenever the inactivity timeout passes. If you return from this
269callback, then the timeout will be reset as if some activity had happened, 274callback, then the timeout will be reset as if some activity had happened,
270so this condition is not fatal in any way. 275so this condition is not fatal in any way.
271 276
778=item $handle->rtimeout ($seconds) 783=item $handle->rtimeout ($seconds)
779 784
780=item $handle->wtimeout ($seconds) 785=item $handle->wtimeout ($seconds)
781 786
782Configures (or disables) the inactivity timeout. 787Configures (or disables) the inactivity timeout.
788
789The timeout will be checked instantly, so this method might destroy the
790handle before it returns.
783 791
784=item $handle->timeout_reset 792=item $handle->timeout_reset
785 793
786=item $handle->rtimeout_reset 794=item $handle->rtimeout_reset
787 795

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines