|
@@ -321,6 +321,13 @@ class Worker
|
|
|
*/
|
|
*/
|
|
|
protected $_socketName = '';
|
|
protected $_socketName = '';
|
|
|
|
|
|
|
|
|
|
+ /** parse from _socketName avoid parse again in master or worker
|
|
|
|
|
+ * LocalSocket The format is like tcp://0.0.0.0:8080
|
|
|
|
|
+ * @var string
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ protected $_localSocket=null;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Context of socket.
|
|
* Context of socket.
|
|
|
*
|
|
*
|
|
@@ -2159,7 +2166,7 @@ class Worker
|
|
|
// Context for socket.
|
|
// Context for socket.
|
|
|
if ($socket_name) {
|
|
if ($socket_name) {
|
|
|
$this->_socketName = $socket_name;
|
|
$this->_socketName = $socket_name;
|
|
|
- $this->parseSocketAddress();
|
|
|
|
|
|
|
+ $this->_localSocket = $this->parseSocketAddress();
|
|
|
if (!isset($context_option['socket']['backlog'])) {
|
|
if (!isset($context_option['socket']['backlog'])) {
|
|
|
$context_option['socket']['backlog'] = static::DEFAULT_BACKLOG;
|
|
$context_option['socket']['backlog'] = static::DEFAULT_BACKLOG;
|
|
|
}
|
|
}
|
|
@@ -2184,7 +2191,7 @@ class Worker
|
|
|
|
|
|
|
|
if (!$this->_mainSocket) {
|
|
if (!$this->_mainSocket) {
|
|
|
|
|
|
|
|
- $local_socket = $this->parseSocketAddress();
|
|
|
|
|
|
|
+ $local_socket = !empty($this->_localSocket)?$this->_localSocket:$this->parseSocketAddress();
|
|
|
|
|
|
|
|
// Flag.
|
|
// Flag.
|
|
|
$flags = $this->transport === 'udp' ? STREAM_SERVER_BIND : STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|
|
$flags = $this->transport === 'udp' ? STREAM_SERVER_BIND : STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
|