Skip to content

Commit

Permalink
Debug stream_context_tcp_nodelay_server
Browse files Browse the repository at this point in the history
  • Loading branch information
bukka committed Dec 31, 2024
1 parent 89534a0 commit 0edf4fd
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,40 @@ $serverCode = <<<'CODE'
$conn = stream_socket_accept($server);
$si = socket_get_option(socket_import_stream($server), SOL_TCP, TCP_NODELAY) > 0 ? "nodelay": "delay";
phpt_notify(message:"server-accepted");
$is = socket_import_stream($server);
phpt_notify(message:"server-imported");
$si = socket_get_option($is, SOL_TCP, TCP_NODELAY) > 0 ? "nodelay": "delay";
phpt_notify(message:"si:$si");
$ic = socket_import_stream($conn);
phpt_notify(message:"conn-imported");
$ci = socket_get_option(socket_import_stream($conn), SOL_TCP, TCP_NODELAY) > 0 ? "nodelay": "delay";
phpt_notify(message:"server-$si:conn-$ci");
CODE;

$clientCode = <<<'CODE'
echo "client start: {{ ADDR }}\n";
$test = stream_socket_client("tcp://{{ ADDR }}", $errno, $errstr, 10);
echo phpt_wait();
echo phpt_wait();
echo phpt_wait();
echo phpt_wait();
echo phpt_wait();
CODE;

include sprintf("%s/../../../openssl/tests/ServerClientTestCase.inc", __DIR__);
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
--EXPECTF--
client start: 127.0.0.1:%d
server-accepted
server-imported
si:delay
conn-imported
server-delay:conn-nodelay

0 comments on commit 0edf4fd

Please sign in to comment.