From 68a107a3e314ffd1973f92db000250f2efcc9908 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Tue, 2 Mar 2010 23:47:12 +0000 Subject: [PATCH] Restore ability to change the Q.921 K value. The Q.921 rewrite only used value of PRI_TIMER_K right after it was set to the default. The Q.921 window size was thus no longer alterable by the user. (closes issue #16909) Reported by: alecdavis Patches: pritimer.libpri.diff.txt uploaded by alecdavis (license 585) Tested by: alecdavis git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1511 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- pri.c | 5 ++--- pri_internal.h | 1 - q921.c | 10 +++++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pri.c b/pri.c index a48841f..a3fc133 100644 --- a/pri.c +++ b/pri.c @@ -349,7 +349,6 @@ struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, default: break; } - p->k = p->timers[PRI_TIMER_K]; if (p->tei == Q921_TEI_GROUP && p->sapi == Q921_SAPI_LAYER2_MANAGEMENT && p->localtype == PRI_CPE) { p->subchannel = __pri_new_tei(-1, p->localtype, p->switchtype, p, NULL, NULL, NULL, Q921_TEI_PRI, 1); @@ -1320,8 +1319,8 @@ char *pri_dump_info_str(struct pri *ctrl) used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u\n", q921outstanding); #endif #if 0 - used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n", ctrl->k, - ctrl->window); + used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n", + ctrl->timers[PRI_TIMER_K], ctrl->window); used = pri_snprintf(buf, used, buf_size, "Sentrej: %d\n", ctrl->sentrej); used = pri_snprintf(buf, used, buf_size, "SolicitFbit: %d\n", ctrl->solicitfbit); used = pri_snprintf(buf, used, buf_size, "Retrans: %d\n", ctrl->retrans); diff --git a/pri_internal.h b/pri_internal.h index 94c82f9..bf744db 100644 --- a/pri_internal.h +++ b/pri_internal.h @@ -97,7 +97,6 @@ struct pri { /* Q.921 State */ int q921_state; - int k; int RC; int peer_rx_busy:1; int own_rx_busy:1; diff --git a/q921.c b/q921.c index e9d0c50..8f4f776 100644 --- a/q921.c +++ b/q921.c @@ -327,18 +327,18 @@ static int q921_send_queued_iframes(struct pri *pri) struct q921_frame *f; int frames_txd = 0; - if (pri->peer_rx_busy || (pri->v_s == Q921_ADD(pri->v_a, pri->k))) { + if (pri->peer_rx_busy || (pri->v_s == Q921_ADD(pri->v_a, pri->timers[PRI_TIMER_K]))) { if (pri->debug & PRI_DEBUG_Q921_DUMP) pri_message(pri, "Couldn't transmit I frame at this time due to peer busy condition or window shut\n"); return 0; } f = pri->txqueue; - while (f && (pri->v_s != Q921_ADD(pri->v_a, pri->k))) { + while (f && (pri->v_s != Q921_ADD(pri->v_a, pri->timers[PRI_TIMER_K]))) { if (!f->transmitted) { /* Send it now... */ if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Finally transmitting %d, since window opened up (%d)\n", f->h.n_s, pri->k); + pri_message(pri, "-- Finally transmitting %d, since window opened up (%d)\n", f->h.n_s, pri->timers[PRI_TIMER_K]); f->transmitted++; f->h.n_s = pri->v_s; f->h.n_r = pri->v_r; @@ -613,7 +613,7 @@ int q921_transmit_iframe(struct pri *vpri, int tei, void *buf, int len, int cr) return 0; } - if (pri->peer_rx_busy || (pri->v_s == Q921_ADD(pri->v_a, pri->k))) { + if (pri->peer_rx_busy || (pri->v_s == Q921_ADD(pri->v_a, pri->timers[PRI_TIMER_K]))) { if (pri->debug & PRI_DEBUG_Q921_DUMP) pri_message(pri, "Couldn't transmit I frame at this time due to peer busy condition or window shut\n"); return 0; @@ -850,7 +850,7 @@ static void q921_dump_pri(struct pri *pri) { pri_message(pri, "TEI: %d State %d\n", pri->tei, pri->q921_state); pri_message(pri, "V(S) %d V(A) %d V(R) %d\n", pri->v_s, pri->v_a, pri->v_r); - pri_message(pri, "K %d, RC %d, l3initiated %d, reject_except %d ack_pend %d\n", pri->k, pri->RC, pri->l3initiated, pri->reject_exception, pri->acknowledge_pending); + pri_message(pri, "K %d, RC %d, l3initiated %d, reject_except %d ack_pend %d\n", pri->timers[PRI_TIMER_K], pri->RC, pri->l3initiated, pri->reject_exception, pri->acknowledge_pending); pri_message(pri, "T200 %d, N200 %d, T203 %d\n", pri->t200_timer, 3, pri->t203_timer); }