A couple of last BRI fixes in libpri... don't discard pending iframes when we call the q921_dchannel_up routine, since we need to be able to send the ones that were queued up while the D-channel went down and is being reactivated. Also fix some buggy logic in the frame transmission decision code.

git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@680 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Matthew Fredrickson 2009-01-27 23:22:06 +00:00
parent a30eeee9a8
commit 3d91cd5e30

14
q921.c
View File

@ -521,7 +521,7 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
pri->txqueue = f;
/* Immediately transmit unless we're in a recovery state, or the window
size is too big */
if ((pri->q921_state != Q921_LINK_CONNECTION_ESTABLISHED) || (!pri->retrans && !pri->busy)) {
if ((pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) && (!pri->retrans && !pri->busy)) {
if (pri->windowlen < pri->window) {
pri->windowlen++;
q921_transmit(pri, (q921_h *)(&f->h), f->len);
@ -538,11 +538,14 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
pri_schedule_del(pri, pri->t203_timer);
pri->t203_timer = 0;
}
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Starting T_200 timer\n");
/* Check this so that we don't try to send frames while multi frame mode is down */
if (pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED)
if (pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Starting T_200 timer\n");
reschedule_t200(pri);
}
} else {
pri_error(pri, "!! Out of memory for Q.921 transmit\n");
return -1;
@ -784,9 +787,6 @@ void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx)
static pri_event *q921_dchannel_up(struct pri *pri)
{
/* Reset counters, etc */
q921_reset(pri);
/* Stop any SABME retransmissions */
if (pri->sabme_timer) {
pri_schedule_del(pri, pri->sabme_timer);