Skip to content

Commit 87bfb76

Browse files
committed
compatible for hhvm
1 parent c589b5a commit 87bfb76

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Workerman/Worker.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,14 +616,16 @@ protected static function parseCommand()
616616
self::log("Workerman[$start_file] already running");
617617
exit;
618618
}
619-
} elseif ($command !== 'start' && $command !== 'restart') {
619+
} elseif ($command !== 'start' && $command !== 'restart' && $command !== 'kill') {
620620
self::log("Workerman[$start_file] not run");
621+
exit;
621622
}
622623

623-
// Execure command.
624+
// execute command.
624625
switch ($command) {
625626
case 'kill':
626627
exec("ps aux | grep $start_file | grep -v grep | awk '{print $2}' |xargs kill -SIGINT");
628+
usleep(100000);
627629
exec("ps aux | grep $start_file | grep -v grep | awk '{print $2}' |xargs kill -SIGKILL");
628630
break;
629631
case 'start':
@@ -1505,7 +1507,7 @@ public function acceptConnection($socket)
15051507
// Accept a connection on server socket.
15061508
$new_socket = @stream_socket_accept($socket, 0, $remote_address);
15071509
// Thundering herd.
1508-
if (false === $new_socket) {
1510+
if (!$new_socket) {
15091511
return;
15101512
}
15111513

start.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
list($method, $addr, $http_version) = explode(' ', $buffer);
3232
$url_data = parse_url($addr);
3333
$addr = !isset($url_data['port']) ? "{$url_data['host']}:80" : "{$url_data['host']}:{$url_data['port']}";
34+
// Async TCP connection.
3435
$remote_connection = new AsyncTcpConnection("tcp://$addr");
3536
// CONNECT.
3637
if ($method !== 'CONNECT') {

0 commit comments

Comments
 (0)