{
int i;
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);
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];
if (force || (zchan->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(zchan, ZAP_CHANNEL_INUSE))) {
break;
if (!element) {
return ZAP_FAIL;
}
- memcpy(&element->boostmsg, msg, msglen);
+ memcpy(element->boostmsg, msg, msglen);
element->size = msglen;
sangoma_boost_data = span->signal_data;
if (mcon->sigmod) {
e = zap_queue_dequeue(mcon->boost_queue);
- bytes = e->size;
- memcpy(&mcon->event, e->boostmsg, bytes);
- zap_safe_free(e);
+ if (e) {
+ bytes = e->size;
+ memcpy(&mcon->event, e->boostmsg, bytes);
+ zap_safe_free(e);
+ }
} else {
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT,
(struct sockaddr *) &mcon->local_addr, &fromlen);
{
unsigned int fromlen = sizeof(struct sockaddr_in);
int bytes = 0;
- sangomabc_queue_element_t *e = NULL;
if (mcon->sigmod) {
- e = zap_queue_dequeue(mcon->boost_queue);
- if (e) {
- bytes = e->size;
- memcpy(&mcon->event, e->boostmsg, bytes);
- zap_safe_free(e);
- }
+ /* priority stuff is handled just the same when there is a sigmod */
+ return sangomabc_connection_read(mcon, iteration);
} else {
bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen);
}