Commit ee6bc94
committed
Force closing a persistent connection via StreamConnection::close()
This is necessary in cases of "out-of-sync" errors or when re-authentication
is required. How to test/reproduce:
// test_auth.php
<?php
// Run php -S localhost:8000 test_auth.php,
// then open the http://localhost:8000/?close=0 page
// and then http://localhost:8000/?close=1
// (authentication must be initiated for both requests)
declare(strict_types=1);
use Tarantool\Client\Client;
use Tarantool\Client\Middleware\AuthenticationMiddleware;
require __DIR__.'/vendor/autoload.php';
$client = Client::fromDsn('tcp://localhost:3301?persistent=true');
$client = $client->withMiddleware(new AuthenticationMiddleware('guest'));
if (isset($_REQUEST['close']) && $_REQUEST['close']) {
$client->getHandler()->getConnection()->close();
}
$client->ping();1 parent c409cc4 commit ee6bc94
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
0 commit comments