TMXR: Fix tmxr_rqln() when speeds are enabled to avoid aways ready condition.

This commit is contained in:
Mark Pizzolato 2019-04-10 15:08:49 -07:00
parent 9dbc800e58
commit 1a48c543d5

View file

@ -2125,23 +2125,23 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */
} }
int32 tmxr_rqln_bare (const TMLN *lp, t_bool speed) static int32 tmxr_rqln_bare (const TMLN *lp, t_bool speed)
{ {
if (speed) { if (speed) {
if (lp->send.extoff < lp->send.insoff) {/* buffered SEND data? */ if (lp->send.extoff < lp->send.insoff) {/* buffered SEND data? */
if (sim_gtime () < lp->send.next_time) if (sim_gtime () < lp->send.next_time) /* too soon? */
return 0; return 0;
else else
return lp->send.delay ? 1 : (lp->send.insoff - lp->send.extoff); return 1;
} }
if (lp->rxbps) { /* consider speed and rate limiting? */ if (lp->rxbps) { /* consider speed and rate limiting? */
if (sim_gtime () < lp->rxnexttime) /* too soon? */ if (sim_gtime () < lp->rxnexttime) /* too soon? */
return 0; return 0;
else else
return 1; return ((lp->rxbpi - lp->rxbpr + ((lp->rxbpi < lp->rxbpr)? lp->rxbsz : 0)) > 0) ? 1 : 0;
} }
} }
return (lp->rxbpi - lp->rxbpr + ((lp->rxbpi < lp->rxbpr)? lp->rxbsz: 0)); return (lp->rxbpi - lp->rxbpr + ((lp->rxbpi < lp->rxbpr)? lp->rxbsz : 0));
} }
/* Return count of available characters ready to be read for line */ /* Return count of available characters ready to be read for line */