Skip to content

Commit 1bf473e

Browse files
committed
poll: ignore port_getn timeout error for eventport
1 parent b712255 commit 1bf473e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

main/poll/php_poll_internal.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ static inline bool php_poll_is_not_found_error(void)
137137
return errno == ENOENT;
138138
}
139139

140+
static inline bool php_poll_is_timeout_error(void)
141+
{
142+
#if defined(ETIME) && defined(ETIMEDOUT)
143+
return errno == ETIME || errno == ETIMEDOUT;
144+
#elif defined(ETIME)
145+
return errno == ETIME;
146+
#elif defined(ETIMEDOUT)
147+
return errno = ETIMEDOUT;
148+
#else
149+
return false;
150+
#endif
151+
}
152+
153+
140154
static inline void php_poll_set_error(php_poll_ctx *ctx, php_poll_error error)
141155
{
142156
ctx->last_error = error;

main/poll/poll_backend_eventport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ static int eventport_backend_wait(
288288
int result = port_getn(backend_data->port_fd, backend_data->events, max_events, &nget, tsp);
289289

290290
if (result == -1) {
291+
if (php_poll_is_timeout_error()) {
292+
return 0;
293+
}
291294
php_poll_set_current_errno_error(ctx);
292295
return -1;
293296
}

0 commit comments

Comments
 (0)