NAME

AnyEvent::TFTPd::CheckConnections - Role for AnyEvent::TFTPd for timeout checking

DESCRIPTION

This Moose role can be applied to AnyEvent::TFTPd which again will provide an AnyEvent timer to check for timed out connections. See also MooseX::Traits for ways to construct this object with this role applied.

SYNOPSIS

use AnyEvent::TFTPd;
use AnyEvent::TFTPd::CheckConnections;

my $tftpd = AnyEvent::TFTPd->new(...);

# apply to all instances of AnyEvent::TFTPd
AnyEvent::TFTPd::CheckConnections->meta->apply(AnyEvent::TFTPd->meta);

# apply only two this instance
AnyEvent::TFTPd::CheckConnections->meta->apply($tftpd);

$tftpd->setup(timeout => 10); # unless set in constructor

ATTRIBUTES

timeout

Holds the timeout set in either constructor or when calling "setup()".

METHODS

after setup

This method modifier will start the timed event which calls "check_connections()".

check_connections

Will loop through all connections to see if any has timed out. If so, decrease the number of retries and retry sending the data to peer if any retries are possible. If not, remove the connection.

It is very important that the AnyEvent::TFTPd object does not have too many connections, since it will cause this loop to stall the program. When that is said, the number of connections will probably cause problems to the rest of the program, before slowing down this method.

BUGS

COPYRIGHT & LICENSE

AUTHOR

See AnyEvent::TFTPd.