Mail::SpamAssassin::AsyncLoop - scanner asynchronous event loop
An asynchronous event loop used for long-running operations, performed ``in the background'' during the Mail::SpamAssassin::check() scan operation, such as DNS blocklist lookups.
start_lookup($obj)$obj
is a hash reference containing the following items:
get_lookup(), etc.
bgsend method. Sadly, the Net::DNS
architecture forces us to keep a separate ID string for this task instead of
reusing key -- if you are not using DNS lookups through DnsResolver, it
should be OK to just reuse key.
DNSBL, MX, TXT.
set_response_packet() or report_id_complete() as
appropriate. DNS-based lookups can leave it undefined, since
DnsResolver::poll_responses() will be called automatically anyway.
The code reference will be called with one argument, the $ent object.
set_response_packet() or report_id_complete().
The code reference will be called with one argument, the $ent object.
$obj is returned by this method.
get_lookup($key)$key.
If the lookup is complete, this will return undef.
Note that a lookup is still considered ``pending'' until complete_lookups() is
called, even if it has been reported as complete via set_response_packet()
or report_id_complete().
get_pending_lookups()Note that a lookup is still considered ``pending'' until complete_lookups() is
called, even if it has been reported as complete via set_response_packet()
or report_id_complete().
complete_lookups()If there are no lookups remaining, or if too long has elapsed since any results
were returned, 1 is returned, otherwise 0.
abort_remaining_lookups()$id is the ID for the
query, and must match the id supplied in start_lookup(). $pkt is the
packet object for the response.
If this was called, $pkt will be available in the completed_callback
function as $ent-<gt{response_packet}>.
One or the other of set_response_packet() or report_id_complete()
should be called, but not both.
report_id_complete($id)$id is the
ID for the query, and must match the id supplied in start_lookup().
One or the other of set_response_packet() or report_id_complete()
should be called, but not both.
get_last_start_lookup_time()start_lookup(). If start_lookup() was
never called or abort_remaining_lookups() has been called
get_last_start_lookup_time() will return undef.