Skip to content

Commit 0f38136

Browse files
Bjarki Arge Andreasenfabiobaltieri
authored andcommitted
modem: modem_cmux: Clear DLCI pipes on open
This commit resets the receive ring buffer for each DLCI pipe when they are opened. They may have old data stored from last time they where opened. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 92ad351 commit 0f38136

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/modem/modem_cmux.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,9 @@ static void modem_cmux_on_dlci_frame_ua(struct modem_cmux_dlci *dlci)
401401
dlci->state = MODEM_CMUX_DLCI_STATE_OPEN;
402402
modem_pipe_notify_opened(&dlci->pipe);
403403
k_work_cancel_delayable(&dlci->open_work);
404+
k_mutex_lock(&dlci->receive_rb_lock, K_FOREVER);
405+
ring_buf_reset(&dlci->receive_rb);
406+
k_mutex_unlock(&dlci->receive_rb_lock);
404407
break;
405408

406409
case MODEM_CMUX_DLCI_STATE_CLOSING:

0 commit comments

Comments
 (0)