Skip to content

Commit 70126fc

Browse files
committed
poll: remove buggy ET emulation from event port
1 parent ef78a97 commit 70126fc

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

ext/standard/tests/poll/poll_stream_sock_rw_multi_edge.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Poll stream - socket write / read multiple times with edge triggering
33
--SKIPIF--
44
<?php
55
require_once __DIR__ . '/poll.inc';
6-
pt_skip_for_backend(['poll', 'wsapoll'], 'does not support edge triggering')
6+
pt_skip_for_backend(['poll', 'wsapoll', 'eventport'], 'does not support edge triggering')
77
?>
88
--FILE--
99
<?php

ext/standard/tests/poll/poll_stream_sock_rw_single_edge.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Poll stream - socket write / read few time only
33
--SKIPIF--
44
<?php
55
require_once __DIR__ . '/poll.inc';
6-
pt_skip_for_backend(['poll', 'wsapoll'], 'does not support edge triggering')
6+
pt_skip_for_backend(['poll', 'wsapoll', 'eventport'], 'does not support edge triggering')
77
?>
88
--FILE--
99
<?php

main/poll/poll_backend_eventport.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -261,25 +261,18 @@ static void eventport_handle_reassociation(
261261
return;
262262
}
263263

264-
/* Determine which events to re-associate with */
265-
uint32_t reassoc_events = entry->events;
266-
if (entry->events & PHP_POLL_ET) {
267-
/* Edge-triggered: don't re-associate with events that just fired */
268-
reassoc_events &= ~fired_events;
269-
reassoc_events &= ~PHP_POLL_ET; /* Remove ET flag for port_associate */
270-
}
271-
272-
if (reassoc_events != 0) {
273-
/* Re-associate for continued monitoring */
274-
int native_events = eventport_events_to_native(reassoc_events);
275-
if (port_associate(backend_data->port_fd, PORT_SOURCE_FD, fd, native_events, entry->data)
276-
!= 0) {
277-
/* Re-association failed - might be due to fd being closed */
278-
php_poll_fd_table_remove(backend_data->fd_table, fd);
279-
backend_data->active_associations--;
280-
}
281-
} else {
282-
/* No events to re-associate with */
264+
/* Re-associate for continued monitoring */
265+
int native_events = eventport_events_to_native(entry->events);
266+
if (native_events == 0) {
267+
/* Nothing meaningful to watch - stop tracking */
268+
php_poll_fd_table_remove(backend_data->fd_table, fd);
269+
backend_data->active_associations--;
270+
return;
271+
}
272+
273+
if (port_associate(backend_data->port_fd, PORT_SOURCE_FD, fd, native_events, entry->data)
274+
!= 0) {
275+
/* Re-association failed - might be due to fd being closed */
283276
php_poll_fd_table_remove(backend_data->fd_table, fd);
284277
backend_data->active_associations--;
285278
}
@@ -401,7 +394,8 @@ const php_poll_backend_ops php_poll_backend_eventport_ops = {
401394
.wait = eventport_backend_wait,
402395
.is_available = eventport_backend_is_available,
403396
.get_suitable_max_events = eventport_backend_get_suitable_max_events,
404-
.supports_et = true /* Supports both level and edge triggering */
397+
.supports_et = false
405398
};
406399

407400
#endif /* HAVE_EVENT_PORTS */
401+

0 commit comments

Comments
 (0)