Bladeren bron

turn off reusePort for unix socket

walkor 6 jaren geleden
bovenliggende
commit
615a4be368
1 gewijzigde bestanden met toevoegingen van 9 en 8 verwijderingen
  1. 9 8
      Worker.php

+ 9 - 8
Worker.php

@@ -2159,14 +2159,6 @@ class Worker
         $this->_autoloadRootPath = \dirname($backtrace[0]['file']);
         Autoloader::setRootPath($this->_autoloadRootPath);
 
-        // Turn reusePort on.
-        if (static::$_OS === \OS_TYPE_LINUX  // if linux
-                            && \version_compare(\PHP_VERSION,'7.0.0', 'ge') // if php >= 7.0.0
-                            && \strtolower(\php_uname('s')) !== 'darwin') { // if not Mac OS
-
-            $this->reusePort = true;
-        }
-
         // Context for socket.
         if ($socket_name) {
             $this->_socketName = $socket_name;
@@ -2176,6 +2168,15 @@ class Worker
             }
             $this->_context = \stream_context_create($context_option);
         }
+        
+        // Turn reusePort on.
+        if (static::$_OS === \OS_TYPE_LINUX  // if linux
+            && \version_compare(\PHP_VERSION,'7.0.0', 'ge') // if php >= 7.0.0
+            && \strtolower(\php_uname('s')) !== 'darwin' // if not Mac OS
+            && $this->transport != 'unix') { // if not unix socket
+
+            $this->reusePort = true;
+        }
     }