/** * Create new message queue capable of holding `maxsize' bytes, and * owned by the supplied node. * * @param maxsize the overall sum of message size that can be held * @param n the network node to which the message queue is attached * @oaram nd the top of the TX stack to use to send out messages * @param uops user-defined operations */ mqueue_t * mq_udp_make(int maxsize, gnutella_node_t *n, struct txdriver *nd, const struct mq_uops *uops) { mqueue_t *q; node_check(n); tx_check(nd); g_assert(uops != NULL); g_assert(maxsize > 0); WALLOC0(q); q->magic = MQ_MAGIC; q->node = n; q->tx_drv = nd; q->maxsize = maxsize; q->lowat = maxsize >> 2; /* 25% of max size */ q->hiwat = maxsize >> 1; /* 50% of max size */ q->qwait = slist_new(); q->ops = &mq_udp_ops; q->cops = mq_get_cops(); q->uops = uops; q->debug = GNET_PROPERTY_PTR(mq_udp_debug); tx_srv_register(nd, mq_udp_service, q); return q; }
/** * Create new message queue capable of holding `maxsize' bytes, and * owned by the supplied node. */ mqueue_t * mq_udp_make(int maxsize, struct gnutella_node *n, struct txdriver *nd) { mqueue_t *q; WALLOC0(q); q->magic = MQ_MAGIC; q->node = n; q->tx_drv = nd; q->maxsize = maxsize; q->lowat = maxsize >> 2; /* 25% of max size */ q->hiwat = maxsize >> 1; /* 50% of max size */ q->qwait = slist_new(); q->ops = &mq_udp_ops; q->cops = mq_get_cops(); q->debug = GNET_PROPERTY_PTR(mq_udp_debug); tx_srv_register(nd, mq_udp_service, q); return q; }
* Dumping context. */ struct dump { const char * const filename; slist_t *slist; const gboolean *dump_var; size_t fill; int fd; int initialized; gnet_property_t dump_property; }; static struct dump dump_rx = { "packets_rx.dump", /* filename in ~/.gtk-gnutella */ NULL, /* slist */ GNET_PROPERTY_PTR(dump_received_gnutella_packets), /* dump_var */ 0, /* fill */ -1, /* fd */ FALSE, /* initialized */ PROP_DUMP_RECEIVED_GNUTELLA_PACKETS, /* dump_property */ }; static struct dump dump_tx = { "packets_tx.dump", /* filename in ~/.gtk-gnutella */ NULL, /* slist */ GNET_PROPERTY_PTR(dump_transmitted_gnutella_packets), /* dump_var */ 0, /* fill */ -1, /* fd */ FALSE, /* initialized */ PROP_DUMP_TRANSMITTED_GNUTELLA_PACKETS, /* dump_property */ };