mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 00:41:41 +00:00
fix hunting of zchan on incoming calls and event reading bug
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@904 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
bd00467c76
commit
bea687fb76
@ -191,10 +191,18 @@ static zap_channel_t *find_zchan(zap_span_t *span, sangomabc_short_event_t *even
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
zap_channel_t *zchan = NULL;
|
zap_channel_t *zchan = NULL;
|
||||||
|
zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
|
||||||
|
int targetspan = event->span+1;
|
||||||
|
int targetchan = event->chan+1;
|
||||||
|
if (sangoma_boost_data->sigmod) {
|
||||||
|
/* span is not strictly needed here since we're supposed to get only events for our span */
|
||||||
|
targetspan = event->span;
|
||||||
|
targetchan = event->chan;
|
||||||
|
}
|
||||||
|
|
||||||
zap_mutex_lock(signal_mutex);
|
zap_mutex_lock(signal_mutex);
|
||||||
for(i = 1; i <= span->chan_count; i++) {
|
for(i = 1; i <= span->chan_count; i++) {
|
||||||
if (span->channels[i]->physical_span_id == event->span+1 && span->channels[i]->physical_chan_id == event->chan+1) {
|
if (span->channels[i]->physical_span_id == targetspan && span->channels[i]->physical_chan_id == targetchan) {
|
||||||
zchan = span->channels[i];
|
zchan = span->channels[i];
|
||||||
if (force || (zchan->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(zchan, ZAP_CHANNEL_INUSE))) {
|
if (force || (zchan->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(zchan, ZAP_CHANNEL_INUSE))) {
|
||||||
break;
|
break;
|
||||||
@ -1549,7 +1557,7 @@ static BOOST_WRITE_MSG_FUNCTION(zap_boost_write_msg)
|
|||||||
if (!element) {
|
if (!element) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
memcpy(&element->boostmsg, msg, msglen);
|
memcpy(element->boostmsg, msg, msglen);
|
||||||
element->size = msglen;
|
element->size = msglen;
|
||||||
|
|
||||||
sangoma_boost_data = span->signal_data;
|
sangoma_boost_data = span->signal_data;
|
||||||
|
@ -277,9 +277,11 @@ sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int
|
|||||||
|
|
||||||
if (mcon->sigmod) {
|
if (mcon->sigmod) {
|
||||||
e = zap_queue_dequeue(mcon->boost_queue);
|
e = zap_queue_dequeue(mcon->boost_queue);
|
||||||
bytes = e->size;
|
if (e) {
|
||||||
memcpy(&mcon->event, e->boostmsg, bytes);
|
bytes = e->size;
|
||||||
zap_safe_free(e);
|
memcpy(&mcon->event, e->boostmsg, bytes);
|
||||||
|
zap_safe_free(e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT,
|
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT,
|
||||||
(struct sockaddr *) &mcon->local_addr, &fromlen);
|
(struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||||
@ -364,15 +366,10 @@ sangomabc_event_t *__sangomabc_connection_readp(sangomabc_connection_t *mcon, in
|
|||||||
{
|
{
|
||||||
unsigned int fromlen = sizeof(struct sockaddr_in);
|
unsigned int fromlen = sizeof(struct sockaddr_in);
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
sangomabc_queue_element_t *e = NULL;
|
|
||||||
|
|
||||||
if (mcon->sigmod) {
|
if (mcon->sigmod) {
|
||||||
e = zap_queue_dequeue(mcon->boost_queue);
|
/* priority stuff is handled just the same when there is a sigmod */
|
||||||
if (e) {
|
return sangomabc_connection_read(mcon, iteration);
|
||||||
bytes = e->size;
|
|
||||||
memcpy(&mcon->event, e->boostmsg, bytes);
|
|
||||||
zap_safe_free(e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen);
|
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user