I notice that nobody ever followed up to the post from 3 years ago about an AnyEvent backend to Danga::Socket.
It seems the world of Perl is converging on AnyEvent as the preferred way of running evented code. In particular you get things like this:
http://search.cpan.org/~mlehmann/AnyEvent-7.02/lib/AnyEvent/DNS.pmA nice stable DNS implementation which we can just use, instead of
Djabberd::DNS
Which contains such gems as this:
# FIXME: is this right? right order and direction?
my @targets = sort {
$a->priority <=> $b->priority ||
$a->weight <=> $b->weight
} grep { ref $_ eq "Net::DNS::RR::SRV" && $_->port } @ans;
To which the answer is "kinda yes, but it doesn't load balance correctly.
Even worse, it uses Net::DNS::Resolver->bgsend, which only queries the first nameserver in /etc/resolv.conf. If that's not available, it silently fails. I have just had production issues because of this, so I care!
So basically, I'd like to have access to AnyEvent. I'm even wondering if we should perform enough surgery on DJabberd that Danga::Socket mainly goes away. It was great for its time, but it doesn't offer anything which AnyEvent doesn't.
The alternative is fixing DNS another way, but I don't see the point in implementing another DNS library when AnyEvent's says this:
AnyEvent::DNS::srv $service, $proto, $domain, $cb->(@srv_rr)
Tries to resolve the given service, protocol and domain name into a list of service records.
Each $srv_rr is an array reference with the following contents: "[$priority, $weight, $transport, $target]".
They will be sorted with lowest priority first, then randomly distributed by weight as per RFC 2782.
Who wants to do that work again?
Bron ( I guess the real question is - since I expect to be doing all the work - is anyone looking to take DJabberd in any other direction, or wedded to keeping it how it is now... ? )