summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Van Parys <alexander.vanparys_ext@softathome.com>2021-06-30 20:12:46 +0200
committerPetr Štetiar <ynezz@true.cz>2021-07-01 13:52:24 +0200
commit38c7fdd8991366cd2f9ccbc47625f9b51b1d318a (patch)
tree2f2f211074e1adef7e95a42240028f071b47a3a3
parent90fb56c00bbd911d929227528e679b174b1f4cec (diff)
downloadubus-38c7fdd8991366cd2f9ccbc47625f9b51b1d318a.tar.gz
ubusd: fix tx_queue linked list usage
Use the correct parameters for list_add_tail when enqueueing a message in the tx_queue. Previously, list_add_tail(list, entry) was used instead of list_add_tail(entry, list). Due to this, the list would only contain the latest entry, and previously inserted entries were left dangling. Reset the tx_queue offset after a message from the tx_queue has been sent completely. Signed-off-by: Alexander Van Parys <alexander.vanparys_ext@softathome.com> (cherry picked from commit 4fc532c8a55ba8217ad67d7fd47c5eb9a8aba044)
-rw-r--r--ubusd.c2
-rw-r--r--ubusd_main.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/ubusd.c b/ubusd.c
index 0e1b0c9..1d76b72 100644
--- a/ubusd.c
+++ b/ubusd.c
@@ -154,7 +154,7 @@ static void ubus_msg_enqueue(struct ubus_client *cl, struct ubus_msg_buf *ub)
INIT_LIST_HEAD(&ubl->list);
ubl->msg = ubus_msg_ref(ub);
- list_add_tail(&cl->tx_queue, &ubl->list);
+ list_add_tail(&ubl->list, &cl->tx_queue);
cl->txq_len += ub->len;
}
diff --git a/ubusd_main.c b/ubusd_main.c
index 3acb29d..e102186 100644
--- a/ubusd_main.c
+++ b/ubusd_main.c
@@ -76,6 +76,7 @@ static void client_cb(struct uloop_fd *sock, unsigned int events)
if (cl->txq_ofs < ub->len + sizeof(ub->hdr))
break;
+ cl->txq_ofs = 0;
ubus_msg_list_free(ubl);
}