Open toddr opened 4 years ago
--- v0.48/Net/Daemon.pm 2011-03-09 17:41:12.000000000 +0100
+++ new/Net/Daemon.pm 2013-01-07 20:11:18.000000000 +0100
@@ -33,6 +33,8 @@
package Net::Daemon;
+use POSIX ":sys_wait_h";
+
$Net::Daemon::VERSION = '0.48';
# Dummy share() in case we're >= 5.10. If we are, require/import of
@@ -491,7 +493,10 @@
} else {
my $pid = fork();
die "Cannot fork: $!" unless defined $pid;
- return if $pid; # Parent
+ if ($pid) { # Parent
+ 1 while (waitpid(-1,WNOHANG) > 0);
+ return;
+ }
$self->$method(@args); # Child
exit(0);
}
This will cause the parent to hang waiting on the child which means simultaneous connections would not be possible. The server needs to track and periodically reap its connections.
More work is needed. PRs welcome.
Migrated from rt.cpan.org#82539 (status was 'new')
Requestors:
Attachments:
From kas@fi.muni.cz on 2013-01-07 19:47:16 :