tbf_dl: fix FBI not set upon X2031 = 0
If Idle TBF timer (X2031) is set to 0, it means the TBF release is
immediately started once all queued data has been scheduled. In that
case, we must set FBI=1 (by setting cv=0) and move to FINISH state.
This used to work over the usual path where X2031 != 0, because release
start will alays happen at a later sched poll time where a dummy LLC
frame is sent and FBI set accordingly.
Change-Id: Ib20602936ae084c413f6bfe14eea33b602020be0
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index d963644..44baa00 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -700,6 +700,16 @@
LOGPTBFDL(this, LOGL_DEBUG,
"LLC queue completely drained and there's "
"still %d free bytes in rlcmac data block\n", space);
+
+ /* We may need to update fbi in header here
+ * since m_last_dl_drained_fn was updated above
+ * Specially important when X2031 is 0. */
+ is_final = llc_queue_size(llc_queue()) == 0 && !keep_open(fn);
+ if (is_final) {
+ rdbi->cv = 0;
+ TBF_SET_STATE(this, GPRS_RLCMAC_FINISHED);
+ }
+
if (mcs_is_edge(cs)) {
/* in EGPRS there's no M bit, so we need
* to flag padding with LI=127 */