Fix for segfault on zap_queue wrap-around
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@942 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
6f1cafa983
commit
b433175950
|
@ -33,7 +33,7 @@
|
|||
* Contributors:
|
||||
*
|
||||
* Moises Silva <moy@sangoma.com>
|
||||
* David Yatzin <davidy@sangoma.com>
|
||||
* David Yat Sin <dyatsin@sangoma.com>
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
*/
|
||||
|
@ -711,8 +711,8 @@ static void handle_call_stop(zap_span_t *span, sangomabc_connection_t *mcon, san
|
|||
* itself through local initiated hangup */
|
||||
|
||||
sangomabc_exec_command(mcon,
|
||||
zchan->physical_span_id-1,
|
||||
zchan->physical_chan_id-1,
|
||||
BOOST_SPAN(zchan),
|
||||
BOOST_CHAN(zchan),
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK,
|
||||
0);
|
||||
|
@ -1036,8 +1036,8 @@ static __inline__ void state_advance(zap_channel_t *zchan)
|
|||
zap_set_sflag_locked(zchan, SFLAG_SENT_FINAL_MSG);
|
||||
|
||||
sangomabc_exec_command(mcon,
|
||||
zchan->physical_span_id-1,
|
||||
zchan->physical_chan_id-1,
|
||||
BOOST_SPAN(zchan),
|
||||
BOOST_CHAN(zchan),
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_STOPPED_ACK,
|
||||
0);
|
||||
|
@ -1058,8 +1058,8 @@ static __inline__ void state_advance(zap_channel_t *zchan)
|
|||
if (!zap_test_sflag(zchan, SFLAG_SENT_ACK)) {
|
||||
zap_set_sflag(zchan, SFLAG_SENT_ACK);
|
||||
sangomabc_exec_command(mcon,
|
||||
zchan->physical_span_id-1,
|
||||
zchan->physical_chan_id-1,
|
||||
BOOST_SPAN(zchan),
|
||||
BOOST_CHAN(zchan),
|
||||
0,
|
||||
SIGBOOST_EVENT_CALL_START_ACK,
|
||||
0);
|
||||
|
@ -1716,7 +1716,6 @@ static BOOST_WRITE_MSG_FUNCTION(zap_boost_write_msg)
|
|||
zap_log(ZAP_LOG_ERROR, "Unexpected boost message %d\n", shortmsg->event_id);
|
||||
return ZAP_FAIL;
|
||||
}
|
||||
|
||||
/* duplicate the event and enqueue it */
|
||||
element = zap_calloc(1, sizeof(*element));
|
||||
if (!element) {
|
||||
|
|
|
@ -76,12 +76,13 @@ static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_e
|
|||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
|
||||
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT: %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
|
||||
dir ? "TX":"RX",
|
||||
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span+1,
|
||||
event->chan+1,
|
||||
event->span,
|
||||
event->chan,
|
||||
event->call_setup_id,
|
||||
event->fseqno,
|
||||
strlen(event->calling_name)?event->calling_name:"N/A",
|
||||
|
@ -94,9 +95,9 @@ static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_
|
|||
{
|
||||
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
|
||||
return;
|
||||
zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
|
||||
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
|
||||
dir ? "TX":"RX",
|
||||
priority ? "P":"N",
|
||||
priority ? "P":"N",
|
||||
sangomabc_event_id_name(event->event_id),
|
||||
event->event_id,
|
||||
event->span,
|
||||
|
@ -322,8 +323,7 @@ sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int
|
|||
msg_ok=0;
|
||||
}
|
||||
|
||||
if (msg_ok){
|
||||
|
||||
if (msg_ok) {
|
||||
if (sangomabc_test_flag(mcon, MSU_FLAG_DOWN)) {
|
||||
if (mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART &&
|
||||
mcon->event.event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK &&
|
||||
|
@ -333,7 +333,7 @@ sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (boost_full_event(mcon->event.event_id)) {
|
||||
sangomabc_print_event_call(mcon, &mcon->event, 0, 0, file, func, line);
|
||||
} else {
|
||||
|
|
|
@ -147,7 +147,7 @@ static __inline__ int boost_full_event(int event_id)
|
|||
switch (event_id) {
|
||||
case SIGBOOST_EVENT_CALL_START:
|
||||
case SIGBOOST_EVENT_DIGIT_IN:
|
||||
case SIGBOOST_EVENT_CALL_PROGRESS:
|
||||
case SIGBOOST_EVENT_CALL_PROGRESS:
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -163,7 +163,7 @@ static void *zap_std_queue_dequeue(zap_queue_t *queue)
|
|||
obj = queue->elements[queue->rindex];
|
||||
queue->elements[queue->rindex++] = NULL;
|
||||
queue->size--;
|
||||
if (queue->rindex == queue->size) {
|
||||
if (queue->rindex == queue->capacity) {
|
||||
queue->rindex = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue