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
This commit is contained in:
Richard Mudgett 2010-03-02 23:47:12 +00:00
parent 307264f7c6
commit 68a107a3e3
3 changed files with 7 additions and 9 deletions

5
pri.c
View File

@ -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);

View File

@ -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;

10
q921.c
View File

@ -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);
}