> # all children should have different seeds, to prevent conflicts
> - srand( time ^ ($$ + ($$ << 15)) );
> + srand();
> + for (0 .. rand(65536)) {
> + Net::DNS::Header::nextid();
> + }
Um.
I see why you want it - but the problem is that Net::DNS::Header is
broken in this usage, it should be fixed instead of hacking us up.
{
my $id = int rand(MAX_ID);
sub nextid {
return $id++ % (MAX_ID + 1);
}
}
Do the DNS request IDs need to be sequential? If not, why not just
replace that with:
sub nextid {
return rand(MAX_ID);
}
and hope it never comes back around?
I really don't like the "increment the counter somwehre between 1 and
64k times to get a unique number" thing you've got going here. It
looks like a hack.
Thread Next