This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20301 )
Change subject: write_queue: use msgb_{en,de}queue_count()
......................................................................
write_queue: use msgb_{en,de}queue_count()
The write_queue.c implemetation predates the msgb_*queue_count()
functions for maintaining a count alongside witha msgb queue. Let's
migrate over to those implementations.
Change-Id: I0ebd42a50f239dd7e9f663ce4c42824a5c1b3ce7
---
M src/write_queue.c
1 file changed, 3 insertions(+), 6 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/write_queue.c b/src/write_queue.c
index c7dedc4..422eda4 100644
--- a/src/write_queue.c
+++ b/src/write_queue.c
@@ -64,11 +64,9 @@
fd->when &= ~OSMO_FD_WRITE;
+ msg = msgb_dequeue_count(&queue->msg_queue, &queue->current_length);
/* the queue might have been emptied */
- if (!llist_empty(&queue->msg_queue)) {
- --queue->current_length;
-
- msg = msgb_dequeue(&queue->msg_queue);
+ if (msg) {
rc = queue->write_cb(fd, msg);
msgb_free(msg);
@@ -110,8 +108,7 @@
if (queue->current_length >= queue->max_length)
return -ENOSPC;
- ++queue->current_length;
- msgb_enqueue(&queue->msg_queue, data);
+ msgb_enqueue_count(&queue->msg_queue, data, &queue->current_length);
queue->bfd.when |= OSMO_FD_WRITE;
return 0;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20301
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0ebd42a50f239dd7e9f663ce4c42824a5c1b3ce7
Gerrit-Change-Number: 20301
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200929/fd7a0eec/attachment.htm>