Skip to content

Commit

Permalink
updates for Swoole 4.7.0
Browse files Browse the repository at this point in the history
Signed-off-by: Demin Yin <deminy@deminy.net>
  • Loading branch information
deminy committed Jul 16, 2021
1 parent 23bbaaf commit 8c181b9
Show file tree
Hide file tree
Showing 17 changed files with 162 additions and 135 deletions.
1 change: 0 additions & 1 deletion output/swoole/aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class_alias(Swoole\Server::class, swoole_server::class);
class_alias(Swoole\Server\Port::class, swoole_server_port::class);
class_alias(Swoole\Server\Task::class, swoole_server_task::class);
class_alias(Swoole\Table::class, swoole_table::class);
class_alias(Swoole\Table\Row::class, swoole_table_row::class);
class_alias(Swoole\Timer::class, swoole_timer::class);
class_alias(Swoole\Timer\Iterator::class, swoole_timer_iterator::class);
class_alias(Swoole\Websocket\Closeframe::class, swoole_websocket_closeframe::class);
Expand Down
31 changes: 20 additions & 11 deletions output/swoole/constants.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

define('SWOOLE_VERSION', '4.6.7');
define('SWOOLE_VERSION_ID', 40607);
define('SWOOLE_VERSION', '4.7.0');
define('SWOOLE_VERSION_ID', 40700);
define('SWOOLE_MAJOR_VERSION', 4);
define('SWOOLE_MINOR_VERSION', 6);
define('SWOOLE_RELEASE_VERSION', 7);
define('SWOOLE_MINOR_VERSION', 7);
define('SWOOLE_RELEASE_VERSION', 0);
define('SWOOLE_EXTRA_VERSION', '');
define('SWOOLE_DEBUG', '');
define('SWOOLE_HAVE_COMPRESSION', '1');
define('SWOOLE_HAVE_ZLIB', '1');
define('SWOOLE_HAVE_BROTLI', '1');
define('SWOOLE_USE_HTTP2', '1');
define('SWOOLE_USE_SHORTNAME', '1');
define('SWOOLE_BASE', 1);
Expand Down Expand Up @@ -78,11 +79,13 @@
define('SWOOLE_ERROR_FILE_NOT_EXIST', 700);
define('SWOOLE_ERROR_FILE_TOO_LARGE', 701);
define('SWOOLE_ERROR_FILE_EMPTY', 702);
define('SWOOLE_ERROR_DNSLOOKUP_DUPLICATE_REQUEST', 703);
define('SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED', 704);
define('SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT', 705);
define('SWOOLE_ERROR_BAD_IPV6_ADDRESS', 706);
define('SWOOLE_ERROR_UNREGISTERED_SIGNAL', 707);
define('SWOOLE_ERROR_DNSLOOKUP_DUPLICATE_REQUEST', 710);
define('SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED', 711);
define('SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT', 712);
define('SWOOLE_ERROR_DNSLOOKUP_UNSUPPORTED', 713);
define('SWOOLE_ERROR_DNSLOOKUP_NO_SERVER', 714);
define('SWOOLE_ERROR_BAD_IPV6_ADDRESS', 720);
define('SWOOLE_ERROR_UNREGISTERED_SIGNAL', 721);
define('SWOOLE_ERROR_EVENT_SOCKET_REMOVED', 800);
define('SWOOLE_ERROR_SESSION_CLOSED_BY_SERVER', 1001);
define('SWOOLE_ERROR_SESSION_CLOSED_BY_CLIENT', 1002);
Expand Down Expand Up @@ -159,6 +162,10 @@
define('SWOOLE_ERROR_CO_PROTECT_STACK_FAILED', 10012);
define('SWOOLE_ERROR_CO_STD_THREAD_LINK_ERROR', 10013);
define('SWOOLE_ERROR_CO_DISABLED_MULTI_THREAD', 10014);
define('SWOOLE_ERROR_CO_CANNOT_CANCEL', 10015);
define('SWOOLE_ERROR_CO_NOT_EXISTS', 10016);
define('SWOOLE_ERROR_CO_CANCELED', 10017);
define('SWOOLE_ERROR_CO_TIMEDOUT', 10018);
define('SWOOLE_TRACE_SERVER', 2);
define('SWOOLE_TRACE_CLIENT', 4);
define('SWOOLE_TRACE_BUFFER', 8);
Expand All @@ -173,7 +180,7 @@
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_WEBSOCKET', 32768);
define('SWOOLE_TRACE_REDIS_CLIENT', 65536);
define('SWOOLE_TRACE_MYSQL_CLIENT', 131072);
define('SWOOLE_TRACE_HTTP_CLIENT', 262144);
Expand All @@ -188,7 +195,8 @@
define('SWOOLE_TRACE_CO_HTTP_SERVER', 134217728);
define('SWOOLE_TRACE_TABLE', 268435456);
define('SWOOLE_TRACE_CO_CURL', 536870912);
define('SWOOLE_TRACE_ALL', 4294967295);
define('SWOOLE_TRACE_CARES', 1073741824);
define('SWOOLE_TRACE_ALL', 9223372036854775807);
define('SWOOLE_LOG_DEBUG', 0);
define('SWOOLE_LOG_TRACE', 1);
define('SWOOLE_LOG_INFO', 2);
Expand Down Expand Up @@ -260,6 +268,7 @@
define('SWOOLE_CHANNEL_OK', 0);
define('SWOOLE_CHANNEL_TIMEOUT', -1);
define('SWOOLE_CHANNEL_CLOSED', -2);
define('SWOOLE_CHANNEL_CANCELED', -3);
define('SWOOLE_HOOK_TCP', 2);
define('SWOOLE_HOOK_UDP', 4);
define('SWOOLE_HOOK_UNIX', 8);
Expand Down
3 changes: 2 additions & 1 deletion output/swoole/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ function swoole_last_error(){}
/**
* @param $domain_name[required]
* @param $timeout[optional]
* @param $type[optional]
* @return mixed
*/
function swoole_async_dns_lookup_coro($domain_name, $timeout = null){}
function swoole_async_dns_lookup_coro($domain_name, $timeout = null, $type = null){}

/**
* @param $settings[required]
Expand Down
16 changes: 15 additions & 1 deletion output/swoole/namespace/Coroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public static function yield()
{
}

/**
* @return mixed
*/
public static function cancel($cid)
{
}

/**
* @return mixed
*/
public static function isCanceled()
{
}

/**
* @return mixed
*/
Expand Down Expand Up @@ -155,7 +169,7 @@ public static function gethostbyname($domain_name, $family = null, $timeout = nu
/**
* @return mixed
*/
public static function dnsLookup($domain_name, $timeout = null)
public static function dnsLookup($domain_name, $timeout = null, $type = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion output/swoole/namespace/Coroutine/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static function gethostbyname($domain_name, $family = null, $timeout = nu
/**
* @return mixed
*/
public static function dnsLookup($domain_name, $timeout = null)
public static function dnsLookup($domain_name, $timeout = null, $type = null)
{
}

Expand Down
14 changes: 14 additions & 0 deletions output/swoole/namespace/Process/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,27 @@ public function write($data)
{
}

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

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

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

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

private $onMessage;

private $onDisconnect;

public $host;

public $port = 0;
Expand Down
32 changes: 2 additions & 30 deletions output/swoole/namespace/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,35 +120,14 @@ public function getMemorySize()
/**
* @return mixed
*/
public function offsetExists($offset)
{
}

/**
* @return mixed
*/
public function offsetGet($offset)
{
}

/**
* @return mixed
*/
public function offsetSet($offset, $value)
{
}

/**
* @return mixed
*/
public function offsetUnset($offset)
public function rewind()
{
}

/**
* @return mixed
*/
public function rewind()
public function valid()
{
}

Expand All @@ -173,12 +152,5 @@ public function key()
{
}

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


}
45 changes: 0 additions & 45 deletions output/swoole/namespace/Table/Row.php

This file was deleted.

13 changes: 13 additions & 0 deletions output/swoole_library/src/core/ArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ public function get($key)
return static::detectType($this->array[$key]);
}

/**
* @param mixed $key
* @param mixed $default
* @return ArrayObject|StringObject
*/
public function getOr($key, $default = null)
{
if (!$this->exists($key)) {
return $default;
}
return static::detectType($this->array[$key]);
}

/**
* @return mixed
*/
Expand Down
4 changes: 2 additions & 2 deletions output/swoole_library/src/core/ConnectionPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public function fill(): void
}
}

public function get()
public function get(float $timeout = -1)
{
if ($this->pool === null) {
throw new RuntimeException('Pool has been closed');
}
if ($this->pool->isEmpty() && $this->num < $this->size) {
$this->make();
}
return $this->pool->pop();
return $this->pool->pop($timeout);
}

public function put($connection): void
Expand Down

0 comments on commit 8c181b9

Please sign in to comment.