develooper Front page | perl.qpsmtpd | Postings from December 2006

Re: [svn:qpsmtpd] r682 - branches/0.3x

Thread Next
From:
Robert Spier
Date:
December 16, 2006 01:36
Subject:
Re: [svn:qpsmtpd] r682 - branches/0.3x
Message ID:
87ac1o9o7k.wl_rs@pobox.com
>      # 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About