.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::SpamAssassin::AsyncLoop 3pm" .TH Mail::SpamAssassin::AsyncLoop 3pm "2022-09-10" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::SpamAssassin::AsyncLoop \- scanner asynchronous event loop .SH "DESCRIPTION" .IX Header "DESCRIPTION" An asynchronous event loop used for long-running operations, performed \*(L"in the background\*(R" during the \fBMail::SpamAssassin::check()\fR scan operation, such as \s-1DNS\s0 blocklist lookups. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$ent = $async\->bgsend_and_start_lookup($name, $type, $class, $ent, $cb, %options)" 4 .el .IP "\f(CW$ent\fR = \f(CW$async\fR\->bgsend_and_start_lookup($name, \f(CW$type\fR, \f(CW$class\fR, \f(CW$ent\fR, \f(CW$cb\fR, \f(CW%options\fR)" 4 .IX Item "$ent = $async->bgsend_and_start_lookup($name, $type, $class, $ent, $cb, %options)" Launch async \s-1DNS\s0 lookups. This is the only official method supported for plugins since version 4.0.0. Do not use bgsend and start_lookup separately. .Sp Merges duplicate queries automatically, only launches one and calls all related callbacks on answer. .RS 4 .ie n .IP "$name (required)" 4 .el .IP "\f(CW$name\fR (required)" 4 .IX Item "$name (required)" Name to query. .ie n .IP "$type (required)" 4 .el .IP "\f(CW$type\fR (required)" 4 .IX Item "$type (required)" Type to query, A, \s-1TXT, NS,\s0 etc. .ie n .IP "$class (required/deprecated)" 4 .el .IP "\f(CW$class\fR (required/deprecated)" 4 .IX Item "$class (required/deprecated)" Deprecated, ignored, set as undef. .ie n .IP "$ent is a required hash reference containing the following items:" 4 .el .IP "\f(CW$ent\fR is a required hash reference containing the following items:" 4 .IX Item "$ent is a required hash reference containing the following items:" .RS 4 .PD 0 .ie n .IP "$ent\->{rulename} (required)" 4 .el .IP "\f(CW$ent\fR\->{rulename} (required)" 4 .IX Item "$ent->{rulename} (required)" .PD The rulename that started and/or depends on this query. Required for rule dependencies to work correctly. Can be a single rulename, or array of multiple rulenames. .ie n .IP "$ent\->{type} (optional)" 4 .el .IP "\f(CW$ent\fR\->{type} (optional)" 4 .IX Item "$ent->{type} (optional)" A string, typically one word, used to describe the type of lookup in log messages, such as \f(CW\*(C`DNSBL\*(C'\fR, \f(CW\*(C`URIBL\-A\*(C'\fR. If not defined, default is value of \&\f(CW$type\fR. .ie n .IP "$ent\->{zone} (optional)" 4 .el .IP "\f(CW$ent\fR\->{zone} (optional)" 4 .IX Item "$ent->{zone} (optional)" A zone specification (typically a \s-1DNS\s0 zone name \- e.g. host, domain, or \&\s-1RBL\s0) which may be used as a key to look up per-zone settings. No semantics on this parameter is imposed by this module. Currently used to fetch by-zone timeouts (from rbl_timeout setting). Defaults to \f(CW$name\fR. .ie n .IP "$ent\->{timeout_initial} (optional)" 4 .el .IP "\f(CW$ent\fR\->{timeout_initial} (optional)" 4 .IX Item "$ent->{timeout_initial} (optional)" An initial value of elapsed time for which we are willing to wait for a response (time in seconds, floating point value is allowed). When elapsed time since a query started exceeds the timeout value and there are no other queries to wait for, the query is aborted. The actual timeout value ranges from timeout_initial and gradually approaches timeout_min (see next parameter) as the number of already completed queries approaches the number of all queries started. .Sp If a caller does not explicitly provide this parameter or its value is undefined, a default initial timeout value is settable by a configuration variable rbl_timeout. .Sp If a value of the timeout_initial parameter is below timeout_min, the initial timeout is set to timeout_min. .ie n .IP "$ent\->{timeout_min} (optional)" 4 .el .IP "\f(CW$ent\fR\->{timeout_min} (optional)" 4 .IX Item "$ent->{timeout_min} (optional)" A lower bound (in seconds) to which the actual timeout approaches as the number of queries completed approaches the number of all queries started. Defaults to 0.2 * timeout_initial. .ie n .IP "$ent\->{key}, $ent\->{id} (deprecated)" 4 .el .IP "\f(CW$ent\fR\->{key}, \f(CW$ent\fR\->{id} (deprecated)" 4 .IX Item "$ent->{key}, $ent->{id} (deprecated)" Deprecated, ignored, automatically generated since 4.0.0. .ie n .IP "$ent\->{\s-1YOUR_OWN_ITEM\s0}" 4 .el .IP "\f(CW$ent\fR\->{\s-1YOUR_OWN_ITEM\s0}" 4 .IX Item "$ent->{YOUR_OWN_ITEM}" Any other custom values/objects that you want to pass on to the answer callback. .RE .RS 4 .RE .ie n .IP "$cb (required)" 4 .el .IP "\f(CW$cb\fR (required)" 4 .IX Item "$cb (required)" Callback function for answer, called as \f(CW$cb\fR\->($ent, \f(CW$pkt\fR). \f(CW$ent\fR is the same object that bgsend_and_start_lookup was called with. \f(CW$pkt\fR is the packet object for the response, Net::DNS:RR objects can be found from \&\f(CW$pkt\fR\->answer. .ie n .IP "%options (required)" 4 .el .IP "\f(CW%options\fR (required)" 4 .IX Item "%options (required)" Hash of options. Only supported and required option is master_deadline: .Sp .Vb 1 \& master_deadline => $pms\->{master_deadline} .Ve .RE .RS 4 .RE .ie n .IP "$ent = $async\->start_lookup($ent, $master_deadline)" 4 .el .IP "\f(CW$ent\fR = \f(CW$async\fR\->start_lookup($ent, \f(CW$master_deadline\fR)" 4 .IX Item "$ent = $async->start_lookup($ent, $master_deadline)" \&\s-1DIRECT USE DEPRECATED\s0 since 4.0.0, please use bgsend_and_start_lookup. .ie n .IP "$ent = $async\->get_lookup($key)" 4 .el .IP "\f(CW$ent\fR = \f(CW$async\fR\->get_lookup($key)" 4 .IX Item "$ent = $async->get_lookup($key)" \&\s-1DEPRECATED\s0 since 4.0.0. Do not use. .ie n .IP "$async\->\fBlog_lookups_timing()\fR" 4 .el .IP "\f(CW$async\fR\->\fBlog_lookups_timing()\fR" 4 .IX Item "$async->log_lookups_timing()" Log sorted timing for all completed lookups. .ie n .IP "$alldone = $async\->\fBcomplete_lookups()\fR" 4 .el .IP "\f(CW$alldone\fR = \f(CW$async\fR\->\fBcomplete_lookups()\fR" 4 .IX Item "$alldone = $async->complete_lookups()" Perform a poll of the pending lookups, to see if any are completed. Callbacks on completed queries will be called from \fBpoll_responses()\fR. .Sp If there are no lookups remaining, or if too much time has elapsed since any results were returned, \f(CW1\fR is returned, otherwise \f(CW0\fR. .ie n .IP "$async\->\fBabort_remaining_lookups()\fR" 4 .el .IP "\f(CW$async\fR\->\fBabort_remaining_lookups()\fR" 4 .IX Item "$async->abort_remaining_lookups()" Abort any remaining lookups. .ie n .IP "$async\->set_response_packet($id, $pkt, $key, $timestamp)" 4 .el .IP "\f(CW$async\fR\->set_response_packet($id, \f(CW$pkt\fR, \f(CW$key\fR, \f(CW$timestamp\fR)" 4 .IX Item "$async->set_response_packet($id, $pkt, $key, $timestamp)" For internal use, do not call from plugins. .Sp Register a \*(L"response packet\*(R" for a given query. \f(CW$id\fR is the \s-1ID\s0 for the query, and must match the \f(CW\*(C`id\*(C'\fR supplied in \f(CW\*(C`start_lookup()\*(C'\fR. \f(CW$pkt\fR is the packet object for the response. A parameter \f(CW$key\fR identifies an entry in a hash %{$self\->{pending_lookups}} where the object which spawned this query can be found, and through which further information about the query is accessible. .Sp \&\f(CW$pkt\fR may be undef, indicating that no response packet is available, but a query has completed (e.g. was aborted or dismissed) and is no longer \*(L"pending\*(R". .Sp The \s-1DNS\s0 resolver's response packet \f(CW$pkt\fR will be made available to a callback subroutine through its argument as well as in \f(CW\*(C`$ent\-. .ie n .IP "$async\->report_id_complete($id,$key,$key,$timestamp)" 4 .el .IP "\f(CW$async\fR\->report_id_complete($id,$key,$key,$timestamp)" 4 .IX Item "$async->report_id_complete($id,$key,$key,$timestamp)" \&\s-1DEPRECATED\s0 since 4.0.0. Do not use. .Sp Legacy. Equivalent to \f(CW$self\fR\->set_response_packet($id,undef,$key,$timestamp), i.e. providing undef as a response packet. Register that a query has completed and is no longer \*(L"pending\*(R". \f(CW$id\fR is the \s-1ID\s0 for the query, and must match the \f(CW\*(C`id\*(C'\fR supplied in \f(CW\*(C`start_lookup()\*(C'\fR. .Sp One or the other of \f(CW\*(C`set_response_packet()\*(C'\fR or \f(CW\*(C`report_id_complete()\*(C'\fR should be called, but not both. .ie n .IP "$time = $async\->\fBlast_poll_responses_time()\fR" 4 .el .IP "\f(CW$time\fR = \f(CW$async\fR\->\fBlast_poll_responses_time()\fR" 4 .IX Item "$time = $async->last_poll_responses_time()" Get the time of the last call to \f(CW\*(C`poll_responses()\*(C'\fR (which is called from \f(CW\*(C`complete_lookups()\*(C'\fR. If \f(CW\*(C`poll_responses()\*(C'\fR was never called or \&\f(CW\*(C`abort_remaining_lookups()\*(C'\fR has been called \f(CW\*(C`last_poll_responses_time()\*(C'\fR will return undef.