Sfoglia il codice sorgente

turn reusePort on by default

turn reusePort on by default for better 	performance
walkor 6 anni fa
parent
commit
c528197ef7
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      Worker.php

+ 8 - 0
Worker.php

@@ -2155,6 +2155,14 @@ class Worker
         $backtrace                = \debug_backtrace();
         $this->_autoloadRootPath = \dirname($backtrace[0]['file']);
 
+        if (static::$_OS === OS_TYPE_LINUX && version_compare(PHP_VERSION,'7.0.0', 'ge')) {
+            $php_uname = strtolower(php_uname('s'));
+            // If not Mac OS then turn reusePort on.
+            if ($php_uname !== 'darwin') {
+                $this->reusePort = true;
+            }
+        }
+
         // Context for socket.
         if ($socket_name) {
             $this->_socketName = $socket_name;