laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/34983?usp=email )

Change subject: LAPD: Flush TX queue, if remote peer enters busy condition or 
rejects
......................................................................

LAPD: Flush TX queue, if remote peer enters busy condition or rejects

In case of a busy condition or a reject (sequence error) from the remove
peer, the messages in the TX queue are obsolete and will be flushed.

Related: OS#4074
Change-Id: Iaaf9aaabb958ef889e252ddd0026ff82cfac981f
---
M src/isdn/lapd_core.c
1 file changed, 29 insertions(+), 1 deletion(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve




diff --git a/src/isdn/lapd_core.c b/src/isdn/lapd_core.c
index be45a95..e352189 100644
--- a/src/isdn/lapd_core.c
+++ b/src/isdn/lapd_core.c
@@ -169,12 +169,17 @@
        }
 }

-static void lapd_dl_flush_tx(struct lapd_datalink *dl)
+static void lapd_dl_flush_tx_queue(struct lapd_datalink *dl)
 {
        struct msgb *msg;

        while ((msg = msgb_dequeue(&dl->tx_queue)))
                msgb_free(msg);
+}
+
+static void lapd_dl_flush_tx(struct lapd_datalink *dl)
+{
+       lapd_dl_flush_tx_queue(dl);
        lapd_dl_flush_hist(dl);
 }

@@ -1376,6 +1381,10 @@
                /* 5.5.5 */
                /* Set peer receiver busy condition */
                dl->peer_busy = 1;
+               /* Flush pending messages in TX queue. */
+               lapd_dl_flush_tx_queue(dl);
+               /* stop Timer T200 */
+               lapd_stop_t200(dl);

                if (lctx->p_f) {
                        if (lctx->cr == dl->cr.rem2loc.cmd) {
@@ -1416,6 +1425,8 @@
                        dl->peer_busy = 0;
                        /* V(S) and V(A) to the N(R) in the REJ frame */
                        dl->v_send = dl->v_ack = lctx->n_recv;
+                       /* Flush pending messages in TX queue. */
+                       lapd_dl_flush_tx_queue(dl);
                        /* stop Timer T200 */
                        lapd_stop_t200(dl);
                        /* 5.5.3.2 */
@@ -1452,6 +1463,8 @@
                        dl->peer_busy = 0;
                        /* V(S) and V(A) to the N(R) in the REJ frame */
                        dl->v_send = dl->v_ack = lctx->n_recv;
+                       /* Flush pending messages in TX queue. */
+                       lapd_dl_flush_tx_queue(dl);
                        /* stop Timer T200 */
                        lapd_stop_t200(dl);
                        /* 5.5.7 Clear timer recovery condition */
@@ -1461,6 +1474,8 @@
                        dl->peer_busy = 0;
                        /* V(S) and V(A) to the N(R) in the REJ frame */
                        dl->v_send = dl->v_ack = lctx->n_recv;
+                       /* Flush pending messages in TX queue. */
+                       lapd_dl_flush_tx_queue(dl);
                        /* 5.5.3.2 */
                        if (lctx->cr == dl->cr.rem2loc.cmd && lctx->p_f) {
                                if (!dl->own_busy && !dl->seq_err_cond) {

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34983?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iaaf9aaabb958ef889e252ddd0026ff82cfac981f
Gerrit-Change-Number: 34983
Gerrit-PatchSet: 5
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to