Skip to content

Commit

Permalink
updates for Swoole 4.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
deminy committed Oct 14, 2020
1 parent 3382a18 commit aefd9d1
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 19 deletions.
15 changes: 12 additions & 3 deletions output/swoole/constants.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

define('SWOOLE_VERSION', '4.5.4');
define('SWOOLE_VERSION_ID', 40504);
define('SWOOLE_VERSION', '4.5.5');
define('SWOOLE_VERSION_ID', 40505);
define('SWOOLE_MAJOR_VERSION', 4);
define('SWOOLE_MINOR_VERSION', 5);
define('SWOOLE_RELEASE_VERSION', 4);
define('SWOOLE_RELEASE_VERSION', 5);
define('SWOOLE_EXTRA_VERSION', '');
define('SWOOLE_DEBUG', '');
define('SWOOLE_HAVE_COMPRESSION', '1');
Expand Down Expand Up @@ -101,6 +101,7 @@
define('SWOOLE_ERROR_SSL_BAD_CLIENT', 1015);
define('SWOOLE_ERROR_SSL_BAD_PROTOCOL', 1016);
define('SWOOLE_ERROR_SSL_RESET', 1017);
define('SWOOLE_ERROR_SSL_HANDSHAKE_FAILED', 1018);
define('SWOOLE_ERROR_PACKAGE_LENGTH_TOO_LARGE', 1201);
define('SWOOLE_ERROR_PACKAGE_LENGTH_NOT_FOUND', 1202);
define('SWOOLE_ERROR_DATA_LENGTH_TOO_LARGE', 1203);
Expand All @@ -110,6 +111,7 @@
define('SWOOLE_ERROR_HTTP2_STREAM_ID_TOO_BIG', 3001);
define('SWOOLE_ERROR_HTTP2_STREAM_NO_HEADER', 3002);
define('SWOOLE_ERROR_HTTP2_STREAM_NOT_FOUND', 3003);
define('SWOOLE_ERROR_HTTP2_STREAM_IGNORE', 3004);
define('SWOOLE_ERROR_AIO_BAD_REQUEST', 4001);
define('SWOOLE_ERROR_AIO_CANCELED', 4002);
define('SWOOLE_ERROR_AIO_TIMEOUT', 4003);
Expand All @@ -119,8 +121,11 @@
define('SWOOLE_ERROR_SOCKS5_UNSUPPORT_METHOD', 7002);
define('SWOOLE_ERROR_SOCKS5_AUTH_FAILED', 7003);
define('SWOOLE_ERROR_SOCKS5_SERVER_ERROR', 7004);
define('SWOOLE_ERROR_SOCKS5_HANDSHAKE_FAILED', 7005);
define('SWOOLE_ERROR_HTTP_PROXY_HANDSHAKE_ERROR', 8001);
define('SWOOLE_ERROR_HTTP_INVALID_PROTOCOL', 8002);
define('SWOOLE_ERROR_HTTP_PROXY_HANDSHAKE_FAILED', 8003);
define('SWOOLE_ERROR_HTTP_PROXY_BAD_RESPONSE', 8004);
define('SWOOLE_ERROR_WEBSOCKET_BAD_CLIENT', 8501);
define('SWOOLE_ERROR_WEBSOCKET_BAD_OPCODE', 8502);
define('SWOOLE_ERROR_WEBSOCKET_UNCONNECTED', 8503);
Expand Down Expand Up @@ -157,13 +162,15 @@
define('SWOOLE_TRACE_CONN', 16);
define('SWOOLE_TRACE_EVENT', 32);
define('SWOOLE_TRACE_WORKER', 64);
define('SWOOLE_TRACE_MEMORY', 128);
define('SWOOLE_TRACE_REACTOR', 256);
define('SWOOLE_TRACE_PHP', 512);
define('SWOOLE_TRACE_HTTP', 1024);
define('SWOOLE_TRACE_HTTP2', 2048);
define('SWOOLE_TRACE_EOF_PROTOCOL', 4096);
define('SWOOLE_TRACE_LENGTH_PROTOCOL', 8192);
define('SWOOLE_TRACE_CLOSE', 16384);
define('SWOOLE_TRACE_WEBSOCEKT', 32768);
define('SWOOLE_TRACE_REDIS_CLIENT', 65536);
define('SWOOLE_TRACE_MYSQL_CLIENT', 131072);
define('SWOOLE_TRACE_HTTP_CLIENT', 262144);
Expand All @@ -176,6 +183,7 @@
define('SWOOLE_TRACE_COROUTINE', 33554432);
define('SWOOLE_TRACE_CONTEXT', 67108864);
define('SWOOLE_TRACE_CO_HTTP_SERVER', 134217728);
define('SWOOLE_TRACE_TABLE', 268435456);
define('SWOOLE_TRACE_ALL', 4294967295);
define('SWOOLE_LOG_DEBUG', 0);
define('SWOOLE_LOG_TRACE', 1);
Expand Down Expand Up @@ -324,6 +332,7 @@
define('SWOOLE_TASK_NOREPLY', 128);
define('SWOOLE_WORKER_BUSY', 1);
define('SWOOLE_WORKER_IDLE', 2);
define('SWOOLE_WORKER_EXIT', 3);
define('SWOOLE_WEBSOCKET_STATUS_CONNECTION', 1);
define('SWOOLE_WEBSOCKET_STATUS_HANDSHAKE', 2);
define('SWOOLE_WEBSOCKET_STATUS_ACTIVE', 3);
Expand Down
7 changes: 7 additions & 0 deletions output/swoole/namespace/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ public function ping()
{
}

/**
* @return mixed
*/
public function goaway()
{
}

/**
* @return mixed
*/
Expand Down
2 changes: 2 additions & 0 deletions output/swoole/namespace/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class Server

public $worker_pid = 0;

public $stats_timer;

public function __construct($host, $port = null, $mode = null, $sock_type = null)
{
}
Expand Down
7 changes: 7 additions & 0 deletions output/swoole/namespace/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public function del($key)
{
}

/**
* @return mixed
*/
public function delete($key)
{
}

/**
* @return mixed
*/
Expand Down
2 changes: 2 additions & 0 deletions output/swoole_library/src/alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ class_alias(Swoole\Coroutine\FastCGI\Client::class, Co\FastCGI\Client::class, tr
class_alias(Swoole\Coroutine\FastCGI\Client\Exception::class, Co\FastCGI\Client\Exception::class, true);
class_alias(Swoole\Coroutine\FastCGI\Proxy::class, Co\FastCGI\Proxy::class, true);
}

class_alias(Swoole\Process\Manager::class, Swoole\Process\ProcessManager::class, true);
2 changes: 2 additions & 0 deletions output/swoole_library/src/core/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ class Constant

public const OPTION_OPEN_REDIS_PROTOCOL = 'open_redis_protocol';

public const OPTION_MAX_IDLE_TIME = 'max_idle_time';

public const OPTION_TCP_KEEPIDLE = 'tcp_keepidle';

public const OPTION_TCP_KEEPINTERVAL = 'tcp_keepinterval';
Expand Down
20 changes: 16 additions & 4 deletions output/swoole_library/src/core/Coroutine/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

function batch(array $tasks, float $timeout = -1): array
{
$wg = new WaitGroup();
$wg->add(count($tasks));
$wg = new WaitGroup(count($tasks));
foreach ($tasks as $id => $task) {
Coroutine::create(function () use ($wg, &$tasks, $id, $task) {
$tasks[$id] = null;
Expand All @@ -31,8 +30,7 @@ function batch(array $tasks, float $timeout = -1): array
function parallel(int $n, callable $fn): void
{
$count = $n;
$wg = new WaitGroup();
$wg->add($n);
$wg = new WaitGroup($n);
while ($count--) {
Coroutine::create(function () use ($fn, $wg) {
$fn();
Expand All @@ -41,3 +39,17 @@ function parallel(int $n, callable $fn): void
}
$wg->wait();
}

function map(array $list, callable $fn, float $timeout = -1): array
{
$wg = new WaitGroup(count($list));
foreach ($list as $id => $elem) {
Coroutine::create(function () use ($wg, &$list, $id, $elem, $fn): void {
$list[$id] = null;
$list[$id] = $fn($elem);
$wg->done();
});
}
$wg->wait($timeout);
return $list;
}
12 changes: 6 additions & 6 deletions output/swoole_library/src/core/Database/PDOStatementProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ public function __call(string $name, array $arguments)
$this->__object->setFetchMode(...$this->setFetchModeContext);
}
if ($this->bindParamContext) {
foreach ($this->bindParamContext as $param => $arguments) {
$this->__object->bindParam($param, ...$arguments);
foreach ($this->bindParamContext as $param => $item) {
$this->__object->bindParam($param, ...$item);
}
}
if ($this->bindColumnContext) {
foreach ($this->bindColumnContext as $column => $arguments) {
$this->__object->bindColumn($column, ...$arguments);
foreach ($this->bindColumnContext as $column => $item) {
$this->__object->bindColumn($column, ...$item);
}
}
if ($this->bindValueContext) {
foreach ($this->bindValueContext as $value => $arguments) {
$this->__object->bindParam($value, ...$arguments);
foreach ($this->bindValueContext as $value => $item) {
$this->__object->bindParam($value, ...$item);
}
}
continue;
Expand Down
16 changes: 11 additions & 5 deletions output/swoole_library/src/core/Database/RedisPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ public function __construct(RedisConfig $config, int $size = self::DEFAULT_SIZE)
$arguments = [
$this->config->getHost(),
$this->config->getPort(),
$this->config->getTimeout(),
$this->config->getReserved(),
$this->config->getRetryInterval(),
$this->config->getReadTimeout(),
];
$arguments = array_filter($arguments);
if ($this->config->getTimeout() !== 0.0) {
$arguments[] = $this->config->getTimeout();
}
if ($this->config->getRetryInterval() !== 0) {
/* reserved should always be NULL */
$arguments[] = null;
$arguments[] = $this->config->getRetryInterval();
}
if ($this->config->getReadTimeout() !== 0.0) {
$arguments[] = $this->config->getReadTimeout();
}
$redis->connect(...$arguments);
if ($this->config->getAuth()) {
$redis->auth($this->config->getAuth());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Swoole\Constant;
use function Swoole\Coroutine\run;

class ProcessManager
class Manager
{
/**
* @var Pool
Expand Down
Loading

0 comments on commit aefd9d1

Please sign in to comment.