--- a/webserver.php Tue Aug 05 13:17:57 2008 -0400
+++ b/webserver.php Fri Aug 15 23:22:30 2008 -0400
@@ -160,6 +160,20 @@
var $socket_initted = false;
/**
+ * The list of child processes spawned by this server.
+ * @var array
+ */
+
+ var $child_list = array();
+
+ /**
+ * The parent process's PID
+ * @var int
+ */
+
+ var $parent_pid = 0;
+
+ /**
* Constructor.
* @param string IPv4 address to bind to
* @param int Port number
@@ -254,6 +268,7 @@
$this->bind_address = $address;
$this->server_string = "PhpHttpd/" . HTTPD_VERSION . " PHP/" . PHP_VERSION . "\r\n";
+ $this->parent_pid = getmypid();
// create a UUID
$uuid_base = md5(microtime() . ( function_exists('mt_rand') ? mt_rand() : rand() ));
@@ -337,6 +352,7 @@
{
// we are the parent, continue listening
socket_close($remote);
+ $this->child_list[] = $pid;
continue;
}
else
@@ -357,11 +373,7 @@
$client_headers = '';
if ( defined('HTTPD_WS_CHILD') )
{
- if ( !@socket_set_timeout($remote, HTTPD_KEEP_ALIVE_TIMEOUT) )
- {
- status('stream_set_timeout() on $remote failed.');
- var_dump($remote);
- }
+ @socket_set_timeout($remote, HTTPD_KEEP_ALIVE_TIMEOUT);
}
if ( $line = @socket_read($remote, 1024, PHP_NORMAL_READ) )
{