|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-14 06:05 UTC] phpxcache at gmail dot com
[2013-07-16 06:12 UTC] osmanov@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: osmanov
-Block user comment: No
+Block user comment: Yes
[2013-07-16 06:12 UTC] osmanov@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 00:00:02 2025 UTC |
Description: ------------ Index: poll.c =================================================================== RCS file: /repository/pecl/event/poll.c,v retrieving revision 1.1 diff -u -r1.1 poll.c --- poll.c 13 Dec 2004 04:56:31 -0000 1.1 +++ poll.c 18 Aug 2005 15:02:12 -0000 @@ -75,11 +75,12 @@ static int poll_event_dispatch(void *arg, struct timeval *tv TSRMLS_DC) { struct poll_state *st = (struct poll_state*)arg; - int res, i, count, msec, nfds; + int res, i, count, msec, nfds, events; struct php_event *ev; struct pollfd *pfd; - if (EVENT_G(event_count) > st->event_count) { + count = EVENT_G(event_count); + if (count > st->event_count) { st->fds = erealloc(st->fds, count * sizeof(struct pollfd)); st->slot_to_event = erealloc(st->slot_to_event, count * sizeof(struct php_event*)); st->event_count = count; @@ -122,28 +123,33 @@ return 0; } - for (i = 0; i < nfds; i++) { - pfd = &st->fds[nfds]; + for (i = 0; res > 0 && i < nfds; i++) { + pfd = &st->fds[i]; + + if (pfd->revents == 0) { + continue; + } + res --; - res = 0; + events = 0; if (pfd->revents & (POLLERR|POLLHUP)) { - res |= EV_READ|EV_WRITE; + events |= EV_READ|EV_WRITE; } if (pfd->revents & POLLIN) { - res |= EV_READ; + events |= EV_READ; } if (pfd->revents & POLLOUT) { - res |= EV_WRITE; + events |= EV_WRITE; } ev = st->slot_to_event[i]; - res &= ev->ev_events; + events &= ev->ev_events; - if (res == 0) { + if (events == 0) { continue; } - event_active(ev, res, 1 TSRMLS_CC); + event_active(ev, events, 1 TSRMLS_CC); } return 0; } ----------------------- in case u don't like the above. here's the clean patch without using (res > 0) Index: poll.c =================================================================== RCS file: /repository/pecl/event/poll.c,v retrieving revision 1.1 diff -u -r1.1 poll.c --- poll.c 13 Dec 2004 04:56:31 -0000 1.1 +++ poll.c 18 Aug 2005 15:06:11 -0000 @@ -79,7 +79,8 @@ struct php_event *ev; struct pollfd *pfd; - if (EVENT_G(event_count) > st->event_count) { + count = EVENT_G(event_count); + if (count > st->event_count) { st->fds = erealloc(st->fds, count * sizeof(struct pollfd)); st->slot_to_event = erealloc(st->slot_to_event, count * sizeof(struct php_event*)); st->event_count = count; @@ -123,7 +124,7 @@ } for (i = 0; i < nfds; i++) { - pfd = &st->fds[nfds]; + pfd = &st->fds[i]; res = 0; if (pfd->revents & (POLLERR|POLLHUP)) {