From 3d91cd5e3080008530f82e57946f7b205b57776f Mon Sep 17 00:00:00 2001 From: Matthew Fredrickson Date: Tue, 27 Jan 2009 23:22:06 +0000 Subject: [PATCH] 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 --- q921.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/q921.c b/q921.c index 0aafd40..704c858 100644 --- a/q921.c +++ b/q921.c @@ -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);