aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_ais.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-02 05:02:54 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-09-02 05:02:54 +0000
commitc32f63c825930d9514d13ad9109610775779c665 (patch)
treeafc6eb9b08ef4ba9f7e0ad1bb4a59b13d5269d90 /res/res_ais.c
parent37f68a5475c8d56ea7fb69d9747edde344aa2b28 (diff)
Merged revisions 284597 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r284597 | tilghman | 2010-09-02 00:00:34 -0500 (Thu, 02 Sep 2010) | 29 lines Merged revisions 284593,284595 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r284593 | tilghman | 2010-09-01 17:59:50 -0500 (Wed, 01 Sep 2010) | 18 lines Merged revisions 284478 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r284478 | tilghman | 2010-09-01 13:49:11 -0500 (Wed, 01 Sep 2010) | 11 lines Ensure that all areas that previously used select(2) now use poll(2), with implementations that need poll(2) implemented with select(2) safe against 1024-bit overflows. This is a followup to the fix for the pthread timer in 1.6.2 and beyond, fixing a potential crash bug in all supported releases. (closes issue #17678) Reported by: russell Branch: https://origsvn.digium.com/svn/asterisk/team/tilghman/ast_select Review: https://reviewboard.asterisk.org/r/824/ ........ ................ r284595 | tilghman | 2010-09-01 22:57:43 -0500 (Wed, 01 Sep 2010) | 2 lines Failed to rerun bootstrap.sh after last commit ................ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@284598 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_ais.c')
-rw-r--r--res/res_ais.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/res/res_ais.c b/res/res_ais.c
index adb3290e1..9bcceeade 100644
--- a/res/res_ais.c
+++ b/res/res_ais.c
@@ -113,9 +113,9 @@ const char *ais_err2str(SaAisErrorT error)
static void *dispatch_thread_handler(void *data)
{
- SaSelectionObjectT clm_fd, evt_fd, max_fd;
+ SaSelectionObjectT clm_fd, evt_fd;
int res;
- fd_set read_fds;
+ struct pollfd pfd[2] = { { .events = POLLIN, }, { .events = POLLIN, } };
SaAisErrorT ais_res;
ais_res = saClmSelectionObjectGet(clm_handle, &clm_fd);
@@ -132,24 +132,26 @@ static void *dispatch_thread_handler(void *data)
return NULL;
}
- max_fd = clm_fd > evt_fd ? clm_fd : evt_fd;
+ pfd[0].fd = clm_fd;
+ pfd[1].fd = evt_fd;
while (!dispatch_thread.stop) {
- FD_ZERO(&read_fds);
- FD_SET(clm_fd, &read_fds);
- FD_SET(evt_fd, &read_fds);
+ pfd[0].revents = 0;
+ pfd[1].revents = 0;
- res = ast_select(max_fd + 1, &read_fds, NULL, NULL, NULL);
+ res = ast_poll(pfd, 2, -1);
if (res == -1 && errno != EINTR && errno != EAGAIN) {
ast_log(LOG_ERROR, "Select error (%s) dispatch thread going away now, "
"and the module will no longer operate.\n", strerror(errno));
break;
}
- if (FD_ISSET(clm_fd, &read_fds))
+ if (pfd[0].revents & POLLIN) {
saClmDispatch(clm_handle, SA_DISPATCH_ALL);
- if (FD_ISSET(evt_fd, &read_fds))
+ }
+ if (pfd[1].revents & POLLIN) {
saEvtDispatch(evt_handle, SA_DISPATCH_ALL);
+ }
}
return NULL;