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"; }