Raphael Manfredi
#include "common.h"
#include "pmsg.h"
#include "qrp.h"
#include "if/core/search.h"
Go to the source code of this file.
Data Structures | |
struct | search_queue |
A search queue. More... | |
Defines | |
#define | sq_count(q) ((q)->count) |
#define | sq_sent(q) ((q)->n_sent) |
Typedefs | |
typedef search_queue | squeue_t |
A search queue. | |
Functions | |
void | sq_init (void) |
Initialization of SQ at startup. | |
void | sq_close (void) |
Cleanup at shutdown time. | |
squeue_t * | sq_global_queue (void) |
squeue_t * | sq_make (struct gnutella_node *node) |
Create a new search queue. | |
void | sq_clear (squeue_t *sq) |
Clear all queued searches. | |
void | sq_free (squeue_t *sq) |
Free queue and all queued searches. | |
void | sq_putq (squeue_t *sq, gnet_search_t sh, pmsg_t *mb) |
Enqueue a single query (LIFO behaviour). | |
void | sq_process (squeue_t *sq, time_t now) |
Decides if the queue can send a message. | |
void | sq_search_closed (squeue_t *sq, gnet_search_t sh) |
Signals the search queue that a search was closed. | |
void | sq_global_putq (gnet_search_t sh, pmsg_t *mb, query_hashvec_t *qhv) |
Enqueue a single query waiting for dynamic querying into global SQ. | |
void | sq_set_peermode (node_peer_t mode) |
Invoked when the current peermode changes. |
|
|
|
|
|
A search queue. There is one search queue per node, placed above the message queue. It is only fed by the queries sent by ourselves. Its purpose is to delay queries to avoid flooding a single connection. |
|
Clear all queued searches.
|
|
Cleanup at shutdown time.
|
|
Free queue and all queued searches.
|
|
Enqueue a single query waiting for dynamic querying into global SQ.
|
|
|
|
Initialization of SQ at startup.
|
|
Create a new search queue.
|
|
Decides if the queue can send a message. Currently use simple fixed time base heuristics. May add bursty control later... |
|
Enqueue a single query (LIFO behaviour). Having the search handle allows us to check before sending the query that we are not over-querying for a given search. It's also handy to remove the queries when a search is closed, and avoid queuing twice the same search.
|
|
Signals the search queue that a search was closed. Any query for that search still in the queue is dropped. |
|
Invoked when the current peermode changes.
|