[Bps-public-commit] HTTP-Server-Simple branch, master, updated. 76636cdf04bf57bcbd65b2a07cc234ba2cc41e23

jesse jesse at bestpractical.com
Mon Aug 17 22:04:58 EDT 2009


The branch, master has been updated
       via  76636cdf04bf57bcbd65b2a07cc234ba2cc41e23 (commit)
      from  f5b2ca6ce59e10b3cb50222288bd8bb48f6af4f5 (commit)

Summary of changes:
 Changes                   |    5 +++++
 lib/HTTP/Server/Simple.pm |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 76636cdf04bf57bcbd65b2a07cc234ba2cc41e23
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Mon Aug 17 22:03:13 2009 -0400

    0.40 - srand after a fork

diff --git a/Changes b/Changes
index 0795e18..8dbbad5 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.40 Mon Aug 17 22:01:07 EDT 2009
+
+* After a fork, we need to reset the random seed lest we have 
+  duplicated random numbers in both forks.
+
 0.39 Mon Aug 17 09:41:05 EDT 2009
 
 * Added signature tests
diff --git a/lib/HTTP/Server/Simple.pm b/lib/HTTP/Server/Simple.pm
index 203f37e..eeac7a5 100644
--- a/lib/HTTP/Server/Simple.pm
+++ b/lib/HTTP/Server/Simple.pm
@@ -8,7 +8,7 @@ use Carp;
 use URI::Escape;
 
 use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.39';
+$VERSION = '0.40';
 
 =head1 NAME
 
@@ -210,6 +210,8 @@ sub background {
     croak "Can't fork: $!" unless defined($child);
     return $child if $child;
 
+    srand(); # after a fork, we need to reset the random seed
+             # or we'll get the same numbers in both branches
     if ( $^O !~ /MSWin32/ ) {
         require POSIX;
         POSIX::setsid()

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list