#include <mq.h>
The queue itself is a two-way list, whose head is kept in `qhead' and the tail in `qtail', since a GList does not keep that information and we don't want to traverse the list each time. Manual bookkeeping required.
Flow control is triggered when the size reaches the high watermark, and remains in effect until we reach the low watermark, thereby providing the necessary hysteresis.
The `qlink' field is used during flow-control. It contains a sorted (by priority) array of all the items in the list. It is dynamically allocated and freed as needed.
The `header' is used to hold the function/hops/TTL of a reference message to be used as a comparison point when speeding up dropping in flow-control.
Data Fields | |
gnutella_header | header |
Comparison point during flow control. | |
gnutella_node * | node |
Node to which this queue belongs. | |
const struct mq_ops * | ops |
Polymorphic operations. | |
const struct mq_cops * | cops |
Common operations. | |
txdrv_t * | tx_drv |
Network TX stack driver. | |
GList * | qhead |
The queue head, new messages are prepended. | |
GList * | qtail |
The queue tail, oldest message to send first. | |
GList ** | qlink |
Sorted array of (GList *) entries, or NULL. | |
gpointer | swift_ev |
Callout queue event in "swift" mode. | |
gint | swift_elapsed |
Scheduled elapsed time, in ms. | |
gint | qlink_count |
Amount of entries in `qlink'. | |
gint | maxsize |
Maximum size of this queue (total queued). | |
gint | count |
Amount of messages queued. | |
gint | hiwat |
High watermark. | |
gint | lowat |
Low watermark. | |
gint | size |
Current amount of bytes queued. | |
gint | flags |
Status flags. | |
gint | last_written |
Amount last written by service routine. | |
gint | flowc_written |
Amount written during flow control. | |
gint | last_size |
Queue size at last "swift" event callback. |
|
Common operations.
|
|
Amount of messages queued.
|
|
Status flags.
|
|
Amount written during flow control.
|
|
Comparison point during flow control.
|
|
High watermark.
|
|
Queue size at last "swift" event callback.
|
|
Amount last written by service routine.
|
|
Low watermark.
|
|
Maximum size of this queue (total queued).
|
|
Node to which this queue belongs.
|
|
Polymorphic operations.
|
|
The queue head, new messages are prepended.
|
|
Sorted array of (GList *) entries, or NULL.
|
|
Amount of entries in `qlink'.
|
|
The queue tail, oldest message to send first.
|
|
Current amount of bytes queued.
|
|
Scheduled elapsed time, in ms.
|
|
Callout queue event in "swift" mode.
|
|
Network TX stack driver.
|