From b6d8099c741a9558676b6e60d93b7cd6d2eb27fa Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Fri, 20 Jan 2023 19:35:55 -0300 Subject: [PATCH] small tweaks fix qprofile with latest changes minor tweaks and qpfrofile related fixes --- mip/mip.c | 10 +++++++--- mongoose.c | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mip/mip.c b/mip/mip.c index cfed8738..403fb61f 100644 --- a/mip/mip.c +++ b/mip/mip.c @@ -829,8 +829,10 @@ static void mip_poll(struct mip_if *ifp, uint64_t uptime_ms) { // Read data from the network size_t len = ifp->driver->rx((void *) ifp->rx.ptr, ifp->rx.len, ifp); - mip_rx(ifp, (void *) ifp->rx.ptr, len); - qp_mark(QP_FRAMEDONE, (int) q_space(&ifp->queue)); + if (len) { + mip_rx(ifp, (void *) ifp->rx.ptr, len); + qp_mark(QP_FRAMEDONE, (int) q_space(&ifp->queue)); + } // Process timeouts for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) { @@ -874,7 +876,9 @@ void mip_qwrite(void *buf, size_t len, struct mip_if *ifp) { size_t mip_qread(void *buf, struct mip_if *ifp) { size_t len = q_read(&ifp->queue, buf); - qp_mark(QP_FRAMEPOPPED, (int) q_space(&ifp->queue)); + if (len) { + qp_mark(QP_FRAMEPOPPED, (int) q_space(&ifp->queue)); + } return len; } diff --git a/mongoose.c b/mongoose.c index cfadd1e4..2015a7df 100644 --- a/mongoose.c +++ b/mongoose.c @@ -7344,8 +7344,10 @@ static void mip_poll(struct mip_if *ifp, uint64_t uptime_ms) { // Read data from the network size_t len = ifp->driver->rx((void *) ifp->rx.ptr, ifp->rx.len, ifp); - mip_rx(ifp, (void *) ifp->rx.ptr, len); - qp_mark(QP_FRAMEDONE, (int) q_space(&ifp->queue)); + if (len) { + mip_rx(ifp, (void *) ifp->rx.ptr, len); + qp_mark(QP_FRAMEDONE, (int) q_space(&ifp->queue)); + } // Process timeouts for (struct mg_connection *c = ifp->mgr->conns; c != NULL; c = c->next) { @@ -7389,7 +7391,9 @@ void mip_qwrite(void *buf, size_t len, struct mip_if *ifp) { size_t mip_qread(void *buf, struct mip_if *ifp) { size_t len = q_read(&ifp->queue, buf); - qp_mark(QP_FRAMEPOPPED, (int) q_space(&ifp->queue)); + if (len) { + qp_mark(QP_FRAMEPOPPED, (int) q_space(&ifp->queue)); + } return len; }