On Monday 30 May 2005 23:30 CET Sidney Markowitz wrote:
> Malte S. Stretz said:
> > If nobody object I will apply the patch tomorrow or so.
>
> I'm fine with the concept. I always thought the name "search" was a bit
> strange for what it was.

Ok, I've committed it.

> I don't see the need for keeping a search sub for "backward
> compatibility". Isn't DnsResolver a new class we introduced with the new
> DNs code that has not been released yet? Just grep through the source to
> make sure that you haven't missed any other references to it.

I left it out (think I got all occurences, they were all in Dns.pm), just 
wasn't sure because you left the new_dns_packet Routine in, too.

Btw, what do you think about renaming the class ::DnsResolver 
to ::Dns::Resolver?

> Regarding Mail::SPF::Query, are you saying that you are going to write
> something that will use our backgrounded resolver insstead of directly
> calling Net::DNS? That has some advantages of reducing the number of
> sockets/filehandles used and letting the queries run in parallel with the
> other processing the way our DNSBL processing does. I looked at doing
> that but it seemed that the DNS queries were too enmeshed in the rest of
> the SPF::Query code to separate out easily.

I have written a Mail::MTAMark::Query module (not yet on CPAN) for which I'm 
currently writing the SpamAssassin plugin (actually, I'm just adapting the 
SPF one :).  The query has three steps: create(), send(Net::DNS::Packet), 
and process(Net::DNS::Packet).  You can use it in three ways:
(a) The simplest one: Just create a new query with new(ip=>...) and call 
$query->result() and it will do all three steps.
(b) The extended simple one:  Feed a parameter resolver=>SomeObject to the 
constructor.  SomeObject needs to have a send method, you can then call 
$query->result(), too, and everything will work as before except that it 
will use your resolver object.
(c) Call all steps you need separately.  So you'd do something like
  $query = Mail::MTAMark::Query->new(ip=>...)
  $packet = $query->create();
  $answer = $my_resolver->send($packet);
  $result = $query->process($answer);
The process step is actually a bit more complicated because I might need to 
send more than one packet, but the important thing is that the third step 
could of course use some more involved logic like bgsend.

Currently I'm implementing (b) in the plugin because I don't know yet how to 
collect the packets later on and if it's possible to send another one then.

The patch I want to write for Mail::SPF::Query will contain at least the (b) 
variant, too, because that's relatively trivial.  Maybe I can also do (c) 
but that would indeed need some refactoring.

Cheers,
Malte

-- 
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
      <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
      <http://www.catb.org/~esr/faqs/smart-questions.html>

Reply via email to