#include "common.h"
#include "nodes.h"
#include "mq.h"
#include "pmsg.h"
#include "gmsg.h"
#include "gnet_stats.h"
#include "lib/walloc.h"
#include "lib/cq.h"
#include "if/gnet_property_priv.h"
#include "lib/override.h"
Defines | |
#define | MQ_PUTQ(o, m) ((o)->ops->putq((o), (m))) |
Functions | |
RCSID ("$Id:mq.c, v 1.12 2005/08/07 22:32:09 cbiere Exp $") | |
void | qlink_free (mqueue_t *q) |
Free the `qlink' sorted array of queued items. | |
void | mq_update_flowc (mqueue_t *q) |
Update flow-control indication for queue. | |
gboolean | make_room_header (mqueue_t *q, gchar *header, guint prio, gint needed, gint *offset) |
Same as make_room(), but we are not given a "pmsg_t" as a comparison point but a Gnutella header and a message priority explicitly. | |
void | mq_swift_timer (cqueue_t *cq, gpointer obj) |
Callout queue callback: periodic "swift" mode timer. | |
void | mq_free (mqueue_t *q) |
Free queue and all enqueued messages. | |
GList * | mq_rmlink_prev (mqueue_t *q, GList *l, gint size) |
Remove link from message queue and return the previous item. | |
void | mq_swift_checkpoint (mqueue_t *q, gboolean initial) |
A "swift" checkpoint was reached. | |
void | mq_enter_swift (cqueue_t *unused_cq, gpointer obj) |
Callout queue callback invoked when the queue must enter "swift" mode. | |
void | mq_enter_flowc (mqueue_t *q) |
Called when the message queue first enters flow-control. | |
void | mq_leave_flowc (mqueue_t *q) |
Leaving flow-control state. | |
void | mq_clear (mqueue_t *q) |
Remove all unsent messages from the queue. | |
void | mq_discard (mqueue_t *q) |
Forbid further writes to the queue. | |
void | mq_shutdown (mqueue_t *q) |
Disable all further writes from the queue. | |
gint | qlink_cmp (const void *lp1, const void *lp2) |
Compare two pointers to links based on their relative priorities, then based on their held Gnutella messages. | |
void | qlink_create (mqueue_t *q) |
Create the `qlink' sorted array of queued items. | |
void | qlink_insert_before (mqueue_t *q, gint hint, GList *l) |
Insert linkable `l' within the sorted qlink array of linkables for the queue, before the position indicated by `hint'. | |
void | qlink_insert (mqueue_t *q, GList *l) |
Insert linkable `l' within the sorted qlink array of linkables. | |
void | qlink_remove (mqueue_t *q, GList *l) |
Remove the entry in the `qlink' linkable array. | |
gboolean | make_room (mqueue_t *q, pmsg_t *mb, gint needed, gint *offset) |
Remove from the queue enough messages that are less prioritary than the current one, so as to make sure we can enqueue it. | |
void | mq_puthere (mqueue_t *q, pmsg_t *mb, gint msize) |
Put message in this queue. | |
void | mq_putq (mqueue_t *q, pmsg_t *mb) |
Enqueue message, which becomes owned by the queue. | |
const struct mq_cops * | mq_get_cops (void) |
Get common operations. | |
Variables | |
const struct mq_cops | mq_cops |
|
|
|
Remove from the queue enough messages that are less prioritary than the current one, so as to make sure we can enqueue it. If `offset' is not null, it may be set with the offset within qlink where the message immediately more prioritary than `mb' can be found. It is up to the caller to initialize it with -1 and check whether it has been set.
|
|
Same as make_room(), but we are not given a "pmsg_t" as a comparison point but a Gnutella header and a message priority explicitly.
|
|
Remove all unsent messages from the queue.
|
|
Forbid further writes to the queue.
|
|
Called when the message queue first enters flow-control.
|
|
Callout queue callback invoked when the queue must enter "swift" mode.
|
|
Free queue and all enqueued messages. Since the message queue is the top of the network TX stack, calling mq_free() recursively requests freeing to lower layers. |
|
Get common operations.
|
|
Leaving flow-control state.
|
|
Put message in this queue.
|
|
Enqueue message, which becomes owned by the queue.
|
|
Remove link from message queue and return the previous item. The `size' parameter refers to the size of the removed message. The underlying message is freed and the size information on the queue is updated, but not the flow-control information. |
|
Disable all further writes from the queue.
|
|
A "swift" checkpoint was reached.
|
|
Callout queue callback: periodic "swift" mode timer.
|
|
Update flow-control indication for queue. Invoke node "callbacks" when crossing a watermark boundary. We define three levels: no flow-control, in warn zone, in flow-control. |
|
Compare two pointers to links based on their relative priorities, then based on their held Gnutella messages. -- qsort() callback |
|
Create the `qlink' sorted array of queued items.
|
|
Free the `qlink' sorted array of queued items.
|
|
Insert linkable `l' within the sorted qlink array of linkables.
|
|
Insert linkable `l' within the sorted qlink array of linkables for the queue, before the position indicated by `hint'.
|
|
Remove the entry in the `qlink' linkable array.
|
|
|
|
Initial value: { mq_puthere, qlink_remove, mq_rmlink_prev, mq_update_flowc, } |