Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sq.h File Reference


Detailed Description

Search queue.

Author:
Alex Bennee <alex@bennee.com>

Raphael Manfredi

Date:
2002-2003

#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_tsq_global_queue (void)
squeue_tsq_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.


Define Documentation

#define sq_count  )     ((q)->count)
 

#define sq_sent  )     ((q)->n_sent)
 


Typedef Documentation

typedef struct search_queue squeue_t
 

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.


Function Documentation

void sq_clear squeue_t sq  ) 
 

Clear all queued searches.

void sq_close void   ) 
 

Cleanup at shutdown time.

void sq_free squeue_t sq  ) 
 

Free queue and all queued searches.

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.

Parameters:
mb the query message
sh the search handle
qhv the query hash vector for QRP matching

squeue_t* sq_global_queue void   ) 
 

Returns:
global queue.

void sq_init void   ) 
 

Initialization of SQ at startup.

squeue_t* sq_make struct gnutella_node node  ) 
 

Create a new search queue.

void sq_process squeue_t sq,
time_t  now
 

Decides if the queue can send a message.

Currently use simple fixed time base heuristics. May add bursty control later...

void sq_putq squeue_t sq,
gnet_search_t  sh,
pmsg_t mb
 

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.

Parameters:
sq DOCUMENT THIS!
mb the query message
sh the search handle

void sq_search_closed squeue_t sq,
gnet_search_t  sh
 

Signals the search queue that a search was closed.

Any query for that search still in the queue is dropped.

void sq_set_peermode node_peer_t  mode  ) 
 

Invoked when the current peermode changes.


Generated on Sun Feb 12 10:50:08 2006 for Gtk-Gnutella by doxygen 1.3.6