Skip to content

Commit ef78a97

Browse files
committed
poll: add one shot mixed test
1 parent 709b5ca commit ef78a97

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Poll stream - TCP read write oneshot combined and mixed
3+
--FILE--
4+
<?php
5+
require_once __DIR__ . '/poll.inc';
6+
7+
list($client, $server) = pt_new_tcp_socket_pair();
8+
$poll_ctx = pt_new_stream_poll();
9+
10+
pt_stream_poll_add($poll_ctx, $client, POLL_EVENT_READ | POLL_EVENT_WRITE | POLL_EVENT_ONESHOT, "client_data");
11+
pt_stream_poll_add($poll_ctx, $server, POLL_EVENT_READ | POLL_EVENT_WRITE | POLL_EVENT_ONESHOT, "server_data");
12+
13+
pt_write_sleep($client, "test data");
14+
pt_expect_events($poll_ctx->wait(0), [
15+
['events' => POLL_EVENT_WRITE, 'data' => 'client_data'],
16+
['events' => POLL_EVENT_READ|POLL_EVENT_WRITE, 'data' => 'server_data']
17+
]);
18+
19+
pt_write_sleep($client, "test data");
20+
pt_expect_events($poll_ctx->wait(100), []);
21+
22+
?>
23+
--EXPECT--
24+
Events matched - count: 2
25+
Events matched - count: 0

0 commit comments

Comments
 (0)