Get number of elements in the queue ? #2397
-
Hi, Using mg_queue API, how is it possible to know how many messages are in the queue ? and how to how many free bytes are left ? I think it could be done with mg_queue.tail/head but I fail to find how. Note: There is an error in the documentation, in the example of mg_queue_del() the call to mg_iobuf_del() shall be replaced with msg_queue_del(). Regards. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Docs fixed, thanks! Lines 45 to 56 in 57fd93e |
Beta Was this translation helpful? Give feedback.
Docs fixed, thanks!
We don't have the need to know that, so we did not care. It would require travelling the queue, thing you would actually do anyway when serving msgs.
https://github.com/cesanta/mongoose/blob/master/src/queue.c
_book() checks for room:
mongoose/src/queue.c
Lines 45 to 56 in 57fd93e