#include "common.h"
#include "oob.h"
#include "hosts.h"
#include "nodes.h"
#include "share.h"
#include "guid.h"
#include "pmsg.h"
#include "mq.h"
#include "mq_udp.h"
#include "vmsg.h"
#include "qhit.h"
#include "gmsg.h"
#include "gnet_stats.h"
#include "if/gnet_property_priv.h"
#include "lib/atoms.h"
#include "lib/cq.h"
#include "lib/fifo.h"
#include "lib/walloc.h"
#include "lib/override.h"
Data Structures | |
struct | oob_results |
A set of hits awaiting delivery. More... | |
struct | gservent |
A servent entry, used as values in the `servent_by_host' table. More... | |
Defines | |
#define | OOB_EXPIRE_MS (2*60*1000) /**< 2 minutes at most */ |
2 minutes at most | |
#define | OOB_TIMEOUT_MS (45*1000) /**< 45 secs for them to reply */ |
45 secs for them to reply | |
#define | OOB_DELIVER_MS (5*1000) /**< 1 message queued every 5 secs */ |
1 message queued every 5 secs | |
#define | OOB_MAX_QUEUED 50 /**< Max # of messages per host */ |
Max # of messages per host. | |
#define | OOB_MAX_RETRY 3 /**< Retry # if LIME/12v2 dropped */ |
Retry # if LIME/12v2 dropped. | |
#define | OOB_MAX_QHIT_SIZE 645 /**< Flush hits larger than this */ |
Flush hits larger than this. | |
Functions | |
RCSID ("$Id:oob.c, v 1.22 2005/10/01 11:45:48 nonamer Exp $") | |
void | results_destroy (cqueue_t *cq, gpointer obj) |
Callout queue callback to free the results. | |
void | servent_free (struct gservent *s) |
Free servent structure. | |
void | oob_send_reply_ind (struct oob_results *r) |
Send them a LIME/12v2, monitoring progress in queue via a callback. | |
oob_results * | results_make (gchar *muid, GSList *files, gint count, gnet_host_t *to, gboolean ggep_h) |
Create new "struct oob_results" to handle the initial negotiation of results delivery via the sent LIME/12v2 and the expected LIME/11v2 reply. | |
void | results_free_remove (struct oob_results *r) |
Dispose of results. | |
void | results_timeout (cqueue_t *unused_cq, gpointer obj) |
Callout queue callback to free the results. | |
void | servent_free_remove (struct gservent *s) |
Dispose of servent, removing entry from the `servent_by_host' table. | |
void | servent_service (cqueue_t *cq, gpointer obj) |
Service servent's FIFO: send next packet, and re-arm servicing callback if there are more data to send. | |
gservent * | servent_make (gnet_host_t *host) |
Create a new servent structure. | |
void | free_pmsg (gpointer item, gpointer unused_udata) |
Cleanup items from FIFO. | |
void | oob_record_hit (gpointer data, size_t len, gpointer udata) |
Invoked via qhit_build_results() for each fully built query hit message. | |
void | oob_deliver_hits (struct gnutella_node *n, gchar *muid, guint8 wanted) |
The remote host acknowledges that we have some hits for it and wishes to get the specified amount. | |
void | oob_pmsg_free (pmsg_t *mb, gpointer arg) |
Callback invoked when the LIME/12v2 message we queued is freed. | |
void | oob_got_results (struct gnutella_node *n, GSList *files, gint count, gboolean use_ggep_h) |
Notification that we got matches for a query from some node that needs to be replied to using out-of-band delivery. | |
void | oob_init (void) |
Initialize out-of-band query hit delivery. | |
void | free_oob_kv (gpointer key, gpointer value, gpointer unused_udata) |
Cleanup oob_results -- hash table iterator callback. | |
void | free_servent_kv (gpointer key, gpointer value, gpointer unused_udata) |
Cleanup servent -- hash table iterator callback. | |
void | oob_shutdown (void) |
Cleanup at shutdown time. | |
void | oob_close (void) |
Final cleanup. | |
Variables | |
GHashTable * | results_by_muid = NULL |
Indexes all OOB queries by MUID. | |
GHashTable * | servent_by_host = NULL |
Each servent, as identified by its IP:port, is given a FIFO for queuing messages and sending them at a rate of 1 message every OOB_DELIVER_MS, to avoid UDP flooding on the remote side. | |
gint | num_oob_records |
Leak and duplicate free detector. |
|
1 message queued every 5 secs
|
|
2 minutes at most
|
|
Flush hits larger than this.
|
|
Max # of messages per host.
|
|
Retry # if LIME/12v2 dropped.
|
|
45 secs for them to reply
|
|
Cleanup oob_results -- hash table iterator callback.
|
|
Cleanup items from FIFO. -- fifo_free_all() callback. |
|
Cleanup servent -- hash table iterator callback.
|
|
Final cleanup.
|
|
The remote host acknowledges that we have some hits for it and wishes to get the specified amount.
|
|
Notification that we got matches for a query from some node that needs to be replied to using out-of-band delivery.
|
|
Initialize out-of-band query hit delivery.
|
|
Callback invoked when the LIME/12v2 message we queued is freed.
|
|
Invoked via qhit_build_results() for each fully built query hit message. Hit is enqueued in the FIFO, for slow delivery. |
|
Send them a LIME/12v2, monitoring progress in queue via a callback.
|
|
Cleanup at shutdown time.
|
|
|
|
Callout queue callback to free the results.
|
|
Dispose of results.
|
|
Create new "struct oob_results" to handle the initial negotiation of results delivery via the sent LIME/12v2 and the expected LIME/11v2 reply.
|
|
Callout queue callback to free the results.
|
|
Free servent structure.
|
|
Dispose of servent, removing entry from the `servent_by_host' table.
|
|
Create a new servent structure.
|
|
Service servent's FIFO: send next packet, and re-arm servicing callback if there are more data to send.
|
|
Leak and duplicate free detector.
|
|
Indexes all OOB queries by MUID. This hash table records MUID => "struct oob_results" |
|
Each servent, as identified by its IP:port, is given a FIFO for queuing messages and sending them at a rate of 1 message every OOB_DELIVER_MS, to avoid UDP flooding on the remote side. This hash table records gnet_host_t => "struct gservent" |