@@ -19,6 +19,7 @@ class Daemon {
19
19
const WSTATE_PREINIT = 4 ;
20
20
const WSTATE_WAITINIT = 5 ;
21
21
const WSTATE_INIT = 6 ;
22
+
22
23
public static $ wstateRev = [
23
24
1 => 'IDLE ' ,
24
25
2 => 'BUSY ' ,
@@ -64,7 +65,13 @@ class Daemon {
64
65
protected static $ masters ;
65
66
protected static $ initservervar ;
66
67
public static $ shm_wstate ;
67
- public static $ reusePort ;
68
+
69
+ /**
70
+ * Сurrently re-using bound ports across multiple processes is available
71
+ * only in BSD flavour operating systems via SO_REUSEPORT socket option
72
+ * @var boolean
73
+ */
74
+ public static $ reusePort = false ;
68
75
public static $ compatMode = FALSE ;
69
76
public static $ runName = 'phpdaemon ' ;
70
77
public static $ config ;
@@ -85,12 +92,12 @@ public static function initSettings() {
85
92
86
93
Daemon::$ config = new Daemon_Config ;
87
94
88
- // currently re-using listener ports across multiple processes is available
89
- // only in BSD flavour operating systems via SO_REUSEPORT socket option
90
- Daemon:: $ reusePort = 1 === preg_match ( " ~BSD~i " , php_uname ( ' s ' ));
95
+ if ( preg_match ( ' ~BSD~i ' , php_uname ( ' s ' ))) {
96
+ Daemon:: $ reusePort = true ;
97
+ }
91
98
92
99
if (Daemon::$ reusePort && !defined ("SO_REUSEPORT " ))
93
- define ("SO_REUSEPORT " , 0x200 ); // FIXME: this is a BSD-only hack
100
+ define ("SO_REUSEPORT " , 0x200 ); // @TODO: FIXME: this is a BSD-only hack
94
101
}
95
102
96
103
public static function loadModuleIfAbsent ($ mod , $ version = null , $ compare = '>= ' ) {
0 commit comments