mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix 29nb_async_connect.phpt
Intermediate states are unreliable across versions (I think), make sure we go through the whole connect procedure.
This commit is contained in:
parent
c7a86a38a3
commit
8f13599a64
1 changed files with 5 additions and 3 deletions
|
@ -23,18 +23,20 @@ if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) {
|
|||
while (TRUE) {
|
||||
switch ($status = pg_connect_poll($db)) {
|
||||
case PGSQL_POLLING_READING:
|
||||
if (nb_is_readable($db_socket)) { break 2; }
|
||||
nb_is_readable($db_socket);
|
||||
break;
|
||||
case PGSQL_POLLING_WRITING:
|
||||
if (nb_is_writable($db_socket)) { break 2; }
|
||||
nb_is_writable($db_socket);
|
||||
break;
|
||||
case PGSQL_POLLING_FAILED:
|
||||
die("async connection failed");
|
||||
case PGSQL_POLLING_OK:
|
||||
break 2;
|
||||
default:
|
||||
die("unknown poll status");
|
||||
}
|
||||
}
|
||||
assert(pg_connection_status($db) === PGSQL_CONNECTION_MADE);
|
||||
assert(pg_connection_status($db) === PGSQL_CONNECTION_OK);
|
||||
echo "OK";
|
||||
|
||||
pg_close($db);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue