From b7632d1b3841ea0b9bba9d6d1976cb47ce0d76dd Mon Sep 17 00:00:00 2001 From: qieangel2013 <904208360@qq.com> Date: Fri, 23 Sep 2016 09:12:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加配置控制参数 --- server/FileDistributedServer.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/FileDistributedServer.php b/server/FileDistributedServer.php index 320ec35..4e46ebc 100644 --- a/server/FileDistributedServer.php +++ b/server/FileDistributedServer.php @@ -317,7 +317,7 @@ public function onReceive($serv, $fd, $from_id, $data) } } if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n', -1); + file_put_contents(ServerLog, date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n', FILE_APPEND); } else { echo date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n'; } @@ -399,7 +399,7 @@ public function onReceive($serv, $fd, $from_id, $data) break; } if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n', -1); + file_put_contents(ServerLog, date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n',FILE_APPEND); } else { echo date('[ c ]') . str_replace("\n", "", var_export($remote_info, true)) . '\r\n'; } @@ -420,7 +420,7 @@ public function onClose($server, $fd, $from_id) if ($v['fd'] == $fd) { FileDistributedClient::getInstance()->removeuser($v['remote_ip'], file_arg); if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . $v['remote_ip'] . " have closed\r\n", -1); + file_put_contents(ServerLog, date('[ c ]') . $v['remote_ip'] . " have closed\r\n", FILE_APPEND); } else { echo date('[ c ]') . $v['remote_ip'] . " have closed\r\n"; } @@ -430,7 +430,7 @@ public function onClose($server, $fd, $from_id) } else { FileDistributedClient::getInstance()->removeuser($this->localip, file_arg); if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", -1); + file_put_contents(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", FILE_APPEND); } else { echo date('[ c ]') . $this->localip . " have closed\r\n"; } @@ -443,7 +443,7 @@ public function onManagerStop($serv) if (empty($this->client_pool)) { FileDistributedClient::getInstance()->removeuser($this->localip, file_arg); if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", -1); + file_put_contents(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", FILE_APPEND); } else { echo date('[ c ]') . $this->localip . " have closed\r\n"; } @@ -456,7 +456,7 @@ public function onWorkerError($serv, $worker_id, $worker_pid, $exit_code) if (empty($this->client_pool)) { FileDistributedClient::getInstance()->removeuser($this->localip, file_arg); if (ServerLog) { - swoole_async_write(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", -1); + file_put_contents(ServerLog, date('[ c ]') . $this->localip . " have closed\r\n", FILE_APPEND); } else { echo date('[ c ]') . $this->localip . " have closed\r\n"; }