mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 05:48:33 +00:00
Merged from master branch
This commit is contained in:
commit
995c250518
66 files changed
+3750
-1728
No files matched your search
@@ -117,29 +117,28 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout
|
||||
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
int err;
|
||||
uint32_t inflags = *flags;
|
||||
uint32_t outflags = 0;
|
||||
sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->mod_data;
|
||||
uint32_t inflags = *flags;
|
||||
uint32_t outflags = 0;
|
||||
sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->io_data;
|
||||
|
||||
err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout);
|
||||
*flags = 0;
|
||||
if (err == SANG_STATUS_SUCCESS) {
|
||||
*flags = outflags;
|
||||
err = 1; /* ideally should be the number of file descriptors with something to read */
|
||||
}
|
||||
if (err == SANG_STATUS_APIPOLL_TIMEOUT) {
|
||||
err = 0;
|
||||
}
|
||||
|
||||
return err;
|
||||
if (err == SANG_STATUS_SUCCESS) {
|
||||
*flags = outflags;
|
||||
err = 1; /* ideally should be the number of file descriptors with something to read */
|
||||
}
|
||||
if (err == SANG_STATUS_APIPOLL_TIMEOUT) {
|
||||
err = 0;
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
struct pollfd pfds[1];
|
||||
int res;
|
||||
int res;
|
||||
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
pfds[0].fd = ftdmchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
memset(&pfds[0], 0, sizeof(pfds[0]));
|
||||
pfds[0].fd = ftdmchan->sockfd;
|
||||
pfds[0].events = *flags;
|
||||
res = poll(pfds, 1, timeout);
|
||||
*flags = 0;
|
||||
|
||||
if (pfds[0].revents & POLLERR) {
|
||||
@@ -150,7 +149,7 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout
|
||||
*flags = pfds[0].revents;
|
||||
}
|
||||
|
||||
return res;
|
||||
return res;
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -253,7 +252,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
|
||||
ftdm_log(FTDM_LOG_ERROR, "failure create waitable object for s%dc%d\n", spanno, x);
|
||||
continue;
|
||||
}
|
||||
chan->mod_data = sangoma_wait_obj;
|
||||
chan->io_data = sangoma_wait_obj;
|
||||
#endif
|
||||
|
||||
chan->physical_span_id = spanno;
|
||||
@@ -542,7 +541,7 @@ static FIO_OPEN_FUNCTION(wanpipe_open)
|
||||
static FIO_CLOSE_FUNCTION(wanpipe_close)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
sangoma_wait_obj_t *waitobj = ftdmchan->mod_data;
|
||||
sangoma_wait_obj_t *waitobj = ftdmchan->io_data;
|
||||
/* kick any I/O waiters */
|
||||
sangoma_wait_obj_signal(waitobj);
|
||||
#endif
|
||||
@@ -960,10 +959,10 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event)
|
||||
for(i = 1; i <= span->chan_count; i++) {
|
||||
ftdm_channel_t *ftdmchan = span->channels[i];
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
if (!ftdmchan->mod_data) {
|
||||
if (!ftdmchan->io_data) {
|
||||
continue; /* should never happen but happens when shutting down */
|
||||
}
|
||||
pfds[j] = ftdmchan->mod_data;
|
||||
pfds[j] = ftdmchan->io_data;
|
||||
inflags[j] = poll_events ? poll_events[j] : POLLPRI;
|
||||
#else
|
||||
memset(&pfds[j], 0, sizeof(pfds[j]));
|
||||
@@ -1299,10 +1298,10 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event)
|
||||
static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
|
||||
{
|
||||
#ifdef LIBSANGOMA_VERSION
|
||||
if (ftdmchan->mod_data) {
|
||||
if (ftdmchan->io_data) {
|
||||
sangoma_wait_obj_t *sangoma_wait_obj;
|
||||
sangoma_wait_obj = ftdmchan->mod_data;
|
||||
ftdmchan->mod_data = NULL;
|
||||
sangoma_wait_obj = ftdmchan->io_data;
|
||||
ftdmchan->io_data = NULL;
|
||||
sangoma_wait_obj_delete(&sangoma_wait_obj);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user