mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@284598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user