| 1 | # You may distribute under the terms of either the GNU General Public License | ||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||
| 3 | # | ||
| 4 | # (C) Paul Evans, 2014 -- leonerd@leonerd.org.uk | ||
| 5 | |||
| 6 | package Net::Async::HTTP::StallTimer; | ||
| 7 | |||
| 8 | 37 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 37 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 37 | ▶ | use base qw( IO::Async::Timer::Countdown ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 37 | our $VERSION = '0.48'; | |
| 13 | |||
| 14 | sub _init | ||
| 15 | { | ||
| 16 | 4 | ▶ | my $self = shift; |
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||
| 17 | 4 | my ( $params ) = @_; | |
| 18 | 4 | $self->SUPER::_init( $params ); | |
| 19 | |||
| 20 | 4 | $self->{future} = delete $params->{future}; | |
| 21 | } | ||
| 22 | |||
| 23 | 14 | ▶ | sub reason :lvalue { shift->{stall_reason} } |
|
Subroutine
reason: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 24 | |||
| 25 | sub on_expire | ||
| 26 | { | ||
| 27 | 4 | ▶ | my $self = shift; |
|
Subroutine
on_expire: called CC=1 SCAR=0.0
Pod
documented
| |||
| 28 | |||
| 29 | 4 | my $conn = $self->parent; | |
| 30 | |||
| 31 | 4 | $self->{future}->fail( "Stalled while ${\$self->reason}", stall_timeout => ); | |
| 32 | |||
| 33 | 4 | $conn->close_now; | |
| 34 | } | ||
| 35 | |||
| 36 | 37 | 0x55AA; | |