| 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-2023 -- leonerd@leonerd.org.uk | ||
| 5 | |||
| 6 | package Net::Async::HTTP::StallTimer 0.50; | ||
| 7 | |||
| 8 | 38 | ▶ | use v5.14; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 38 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 38 | ▶ | use base qw( IO::Async::Timer::Countdown ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | sub _init | ||
| 13 | 4 | ▶ | { |
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||
| 14 | 4 | my $self = shift; | |
| 15 | 4 | my ( $params ) = @_; | |
| 16 | 4 | $self->SUPER::_init( $params ); | |
| 17 | |||
| 18 | 4 | $self->{future} = delete $params->{future}; | |
| 19 | } | ||
| 20 | |||
| 21 | 14 | ▶ | sub reason :lvalue { shift->{stall_reason} } |
|
Subroutine
reason: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 22 | |||
| 23 | sub on_expire | ||
| 24 | 4 | ▶ | { |
|
Subroutine
on_expire: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 4 | my $self = shift; | |
| 26 | |||
| 27 | 4 | my $conn = $self->parent; | |
| 28 | |||
| 29 | 4 | $self->{future}->fail( "Stalled while ${\$self->reason}", stall_timeout => ); | |
| 30 | |||
| 31 | 4 | $conn->close_now; | |
| 32 | } | ||
| 33 | |||
| 34 | 38 | 0x55AA; | |