diff --git a/applications/Statistics/Lib/functions.php b/applications/Statistics/Lib/functions.php index 6fb4705d1..68511a1c1 100644 --- a/applications/Statistics/Lib/functions.php +++ b/applications/Statistics/Lib/functions.php @@ -31,7 +31,7 @@ function multiRequest($request_buffer_array) // 轮询处理数据 while(count($read) > 0) { - if(stream_select($read, $write, $except, 0, 200000)) + if(@stream_select($read, $write, $except, 0, 200000)) { foreach($read as $socket) { diff --git a/workerman/Common/Protocols/Http/Http.php b/workerman/Common/Protocols/Http/Http.php index f035d8c0c..bf8826d24 100644 --- a/workerman/Common/Protocols/Http/Http.php +++ b/workerman/Common/Protocols/Http/Http.php @@ -159,7 +159,7 @@ function http_start($http_string, $SERVER = array()) // 需要解析$_POST if($_SERVER['REQUEST_METHOD'] == 'POST') { - if($_SERVER['CONTENT_TYPE'] == 'multipart/form-data') + if(isset($_SERVER['CONTENT_TYPE']) && $_SERVER['CONTENT_TYPE'] == 'multipart/form-data') { parse_upload_files($http_body, $http_post_boundary); } diff --git a/workerman/Core/Events/Select.php b/workerman/Core/Events/Select.php index d8739fb78..90253bb7d 100644 --- a/workerman/Core/Events/Select.php +++ b/workerman/Core/Events/Select.php @@ -34,6 +34,20 @@ class Select implements BaseEvent */ public $writeFds = array(); + /** + * 构造函数 创建一个管道,避免select空fd + * @return void + */ + public function __construct() + { + $this->channel = stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP); + if($this->channel) + { + stream_set_blocking($this->channel[0], 0); + $this->readFds[0] = $this->channel[0]; + } + } + /** * 添加事件 * @see \Man\Core\Events\BaseEvent::add() @@ -121,7 +135,7 @@ public function loop() // 触发信号处理函数 pcntl_signal_dispatch(); // stream_select false:出错 ; 0:超时 - if(!($ret = @stream_select($read, $write, $e, PHP_INT_MAX))) + if(!($ret = @stream_select($read, $write, $e, 60))) { // 超时 if($ret === 0)