From a9eead18244638fb27ec2c71bd0f9336c8888a4d Mon Sep 17 00:00:00 2001 From: Ryan Erickson Date: Thu, 3 Feb 2022 16:53:35 -0600 Subject: [PATCH] modem: hl7800: only send null packet for TCP Only TCP sockets should send a NULL packet if the server closes the connection or there is a socket error. UDP sockets do not need to do this because they are connectionless. Signed-off-by: Ryan Erickson --- drivers/modem/hl7800.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index 498c3ab15e..6dc613ffcb 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -3506,10 +3506,12 @@ static void sock_notif_cb_work(struct k_work *work) k_work_reschedule_for_queue(&hl7800_workq, &sock->notif_work, MDM_SOCK_NOTIF_DELAY); } else { - LOG_DBG("Sock %d trigger NULL packet", sock->socket_id); - sock->state = SOCK_SERVER_CLOSED; - k_work_submit_to_queue(&hl7800_workq, &sock->recv_cb_work); - sock->error = false; + if (sock->type == SOCK_STREAM) { + LOG_DBG("Sock %d trigger NULL packet", sock->socket_id); + sock->state = SOCK_SERVER_CLOSED; + k_work_submit_to_queue(&hl7800_workq, &sock->recv_cb_work); + sock->error = false; + } } hl7800_unlock(); }