Permalink
Browse files

Bugfix

  • Loading branch information...
1 parent d1498a8 commit 95146a58586a1926f11764f41f9debd04a362b5a @kakserpom committed Mar 20, 2013
Showing with 13 additions and 6 deletions.
  1. +1 −1 lib/BoundTCPSocket.php
  2. +12 −5 lib/Daemon.php
@@ -59,7 +59,7 @@ public function bindSocket() {
return false;
}
$port = isset($this->uri['port']) ? $this->uri['port'] : $this->defaultPort;
- if (($port < 1024) && Daemon::$config->user !== 'root') {
+ if (($port < 1024) && Daemon::$config->user->value !== 'root') {
$this->listenerMode = false;
}
if ($this->listenerMode) {
View
@@ -19,6 +19,7 @@ class Daemon {
const WSTATE_PREINIT = 4;
const WSTATE_WAITINIT = 5;
const WSTATE_INIT = 6;
+
public static $wstateRev = [
1 => 'IDLE',
2 => 'BUSY',
@@ -64,7 +65,13 @@ class Daemon {
protected static $masters;
protected static $initservervar;
public static $shm_wstate;
- public static $reusePort;
+
+ /**
+ * Сurrently re-using bound ports across multiple processes is available
+ * only in BSD flavour operating systems via SO_REUSEPORT socket option
+ * @var boolean
+ */
+ public static $reusePort = false;
public static $compatMode = FALSE;
public static $runName = 'phpdaemon';
public static $config;
@@ -85,12 +92,12 @@ public static function initSettings() {
Daemon::$config = new Daemon_Config;
- // currently re-using listener ports across multiple processes is available
- // only in BSD flavour operating systems via SO_REUSEPORT socket option
- Daemon::$reusePort = 1 === preg_match("~BSD~i", php_uname('s'));
+ if (preg_match('~BSD~i', php_uname('s'))) {
+ Daemon::$reusePort = true;
+ }
if (Daemon::$reusePort && !defined("SO_REUSEPORT"))
- define("SO_REUSEPORT", 0x200); // FIXME: this is a BSD-only hack
+ define("SO_REUSEPORT", 0x200); // @TODO: FIXME: this is a BSD-only hack
}
public static function loadModuleIfAbsent($mod, $version = null, $compare = '>=') {

0 comments on commit 95146a5

Please sign in to comment.