Skip to content

Commit

Permalink
Update version for Swoole 4.5.10 (#3951)
Browse files Browse the repository at this point in the history
* Fix connection_list error (#3948)

* Update version for Swoole 4.5.10

* Fix name uninitialized
  • Loading branch information
sy-records authored Dec 22, 2020
1 parent 6eb7ddc commit 57c7112
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT(libswoole)

ENABLE_LANGUAGE(ASM)
SET(SWOOLE_VERSION 4.5.9)
SET(SWOOLE_VERSION 4.5.10)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
Expand Down
2 changes: 1 addition & 1 deletion ext-src/swoole_http_response.cc
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ static PHP_METHOD(swoole_http_response, sendfile) {
}

static void php_swoole_http_response_cookie(INTERNAL_FUNCTION_PARAMETERS, const bool url_encode) {
char *name, *value = nullptr, *path = nullptr, *domain = nullptr, *samesite = nullptr, *priority = nullptr;
char *name = nullptr, *value = nullptr, *path = nullptr, *domain = nullptr, *samesite = nullptr, *priority = nullptr;
zend_long expires = 0;
size_t name_len, value_len = 0, path_len = 0, domain_len = 0, samesite_len = 0, priority_len = 0;
zend_bool secure = 0, httponly = 0;
Expand Down
16 changes: 8 additions & 8 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
<email>[email protected]</email>
<active>yes</active>
</developer>
<date>2020-11-26</date>
<time>00:00:00</time>
<date>2020-12-22</date>
<time>09:00:00</time>
<version>
<release>4.5.9</release>
<release>4.5.10</release>
<api>4.0</api>
</version>
<stability>
Expand All @@ -54,13 +54,11 @@
</stability>
<license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache2.0</license>
<notes>
Enhancement
---
+ Added SWOOLE_HTTP_CLIENT_ESTATUS_SEND_FAILED constant for Coroutine\\Http\\Client (#3873) (@sy-records)

Fixed
---
* Fixed PHP8 compatibility (#3868) (#3869) (#3872) (@twose) (@huanghantao) (@doubaokun)
* Fixed #3906, sync master (93901dc0) (@matyhtf)
* Fixed PHP8 compatibility (f0dc6d32) (@matyhtf)
* Fixed connection_list error (#3948) (@sy-records)
</notes>
<contents>
<dir name="/">
Expand Down Expand Up @@ -1515,6 +1513,7 @@
<file role="test" name="tests/swoole_server/close_in_connect_callback.phpt" />
<file role="test" name="tests/swoole_server/close_in_non_current_worker.phpt" />
<file role="test" name="tests/swoole_server/close_in_task_worker.phpt" />
<file role="test" name="tests/swoole_server/close_max_fd.phpt" />
<file role="test" name="tests/swoole_server/close_queued.phpt" />
<file role="test" name="tests/swoole_server/connections.phpt" />
<file role="test" name="tests/swoole_server/discard_timeout_packet.phpt" />
Expand Down Expand Up @@ -1907,6 +1906,7 @@
<file role="src" name="travis/pecl-install.sh" />
<file role="src" name="travis/route.sh" />
<file role="src" name="travis/run-tests.sh" />
<file role="src" name="travis/simple-compile-on-github.sh" />
<file role="src" name="travis/simple-compile.sh" />
</dir>
</contents>
Expand Down
2 changes: 1 addition & 1 deletion src/server/reactor_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ int Server::close_connection(Reactor *reactor, Socket *socket) {
int find_max_fd = fd - 1;
swTrace("set_maxfd=%d|close_fd=%d\n", find_max_fd, fd);
// find the new max_fd
for (; serv->is_valid_connection(serv->get_connection(find_max_fd)) && find_max_fd > serv->get_minfd();
for (; !serv->is_valid_connection(serv->get_connection(find_max_fd)) && find_max_fd > serv->get_minfd();
find_max_fd--) {
// pass
}
Expand Down
86 changes: 86 additions & 0 deletions tests/swoole_server/close_max_fd.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
--TEST--
swoole_server: close_max_fd
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require __DIR__ . '/../include/bootstrap.php';

use Swoole\Server;

$pm = new SwooleTest\ProcessManager;
$pm->parentFunc = function () use ($pm) {
Co\run(function () use ($pm) {
go(function() use ($pm) {
$client = new Co\Client(SWOOLE_SOCK_TCP);
Assert::assert($client->connect('127.0.0.1', $pm->getFreePort()));
Assert::assert($client->send('test'));
$client->recv();
Co::sleep(2);
$client->send('ping');
Co::sleep(2);
$pm->kill();
});
go(function() use ($pm) {
$cli = new Co\Http\Client('127.0.0.1', $pm->getFreePort());
});
go(function() use ($pm) {
$client = new Co\Client(SWOOLE_SOCK_TCP);
Assert::assert($client->connect('127.0.0.1', $pm->getFreePort()));
$client->send('test2');
});
});
};
$pm->childFunc = function () use ($pm) {
$server = new Swoole\Server('127.0.0.1', $pm->getFreePort());
$server->set([
'worker_num' => 1,
'log_level' => SWOOLE_LOG_ERROR,
]);

$server->on('receive', function (Swoole\Server $serv, int $fd, int $rid, string $data) {
var_dump($data);
var_dump($serv->getClientList());
Assert::true(!empty($serv->getClientList()));
foreach ($serv->connections as $_fd) {
var_dump("fd:{$_fd}");
}
$serv->send($fd, "Server: " . $data);
});

$server->on('Close', function ($server, $fd) {
echo "Client:{$fd} Close.\n";
});

$server->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECT--
string(4) "test"
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
string(4) "fd:1"
string(4) "fd:2"
string(5) "test2"
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
string(4) "fd:1"
string(4) "fd:2"
Client:2 Close.
string(4) "ping"
array(1) {
[0]=>
int(1)
}
string(4) "fd:1"
Client:1 Close.

0 comments on commit 57c7112

Please sign in to comment.