Skip to content

Commit

Permalink
Update Test.php
Browse files Browse the repository at this point in the history
  • Loading branch information
morozovsk authored Jun 21, 2016
1 parent b365fd3 commit c1e7886
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public function __construct($config) {

public function start() {
for ($i=0; $i < $this->config['workers']-1; $i++) {
$pid = pcntl_fork();//создаём форк
$pid = pcntl_fork();//create the fork
if ($pid == -1) {
die("error: pcntl_fork\r\n");
} elseif (!$pid) {//воркер
} elseif (!$pid) {//worker
break;
}
}
Expand All @@ -36,12 +36,12 @@ public function start() {
}

while (true) {
//подготавливаем массив всех сокетов, которые нужно обработать
//prepare an array of sockets that need to be processed
$read = array_slice($this->clients, 0, 1000);

stream_select($read, $write, $except, null);//обновляем массив сокетов, которые можно обработать
stream_select($read, $write, $except, null);//update the array of sockets that can be processed

if ($read) {//пришли данные от подключенных клиентов
if ($read) {//obtained data from connected clients
foreach ($read as $client) {
$data = fread($client, 100000);

Expand Down Expand Up @@ -75,4 +75,4 @@ public function start() {
'workers' => intval($argv[4]),
];
(new Test($config))->start();
}
}

0 comments on commit c1e7886

Please sign in to comment.