tbf: Do not reuse old TBF after RACH requests

Currently existing TBF can be reused after an MS has sent a RACH
request. Since the MS can be or most probably is in packet idle mode
in that case, the TBF are no longer usable even if they share the
PDCHs and the control TS with the new one.

There are occasional freezes where the MS does no longer react to
messages sent on the PACCH.

This change aborts all pending TBFs if a new TBF is or has been
established via RACH.

Sponsored-by: On-Waves ehf
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 93c932b..8018347 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1072,15 +1072,8 @@
 
 		if (!ms())
 			set_ms(old_ms);
-
-		/* there might be an active and valid downlink TBF */
-		if (!ms()->dl_tbf() && dl_tbf)
-			/* Move it to the current MS (see the guard above) */
-			dl_tbf->set_ms(ms());
 	}
 
-	/* The TLLI has been taken from an UL message */
-	update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
 	if (dl_tbf && dl_tbf->ms() != ms()) {
 		LOGP(DRLCMACUL, LOGL_NOTICE, "Got RACH from "
 			"TLLI=0x%08x while %s still exists. "
@@ -1097,6 +1090,14 @@
 		tbf_free(ul_tbf);
 		ul_tbf = NULL;
 	}
+
+	/* The TLLI has been taken from an UL message */
+	update_ms(new_tlli, GPRS_RLCMAC_UL_TBF);
+
+#if 0 /* REMOVEME ??? */
+	if (ms()->need_dl_tbf())
+		establish_dl_tbf_on_pacch();
+#endif
 	return 1;
 }