Skip to content

Commit

Permalink
增加配置控制参数
Browse files Browse the repository at this point in the history
增加配置控制参数
  • Loading branch information
qieangel2013 committed Sep 23, 2016
1 parent d209d5e commit b7632d1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/FileDistributedServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down Expand Up @@ -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';
}
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand Down

0 comments on commit b7632d1

Please sign in to comment.