Exemple #1
0
/**
 * Expire the tsync record.
 */
static void
tsync_expire(cqueue_t *unused_cq, void *obj)
{
	struct tsync *ts = obj;
	struct gnutella_node *n;

	(void) unused_cq;

	g_assert(ts);
	g_assert(ts->magic == TSYNC_MAGIC);

	if (GNET_PROPERTY(tsync_debug) > 1)
		g_debug("TSYNC expiring time %d.%d",
			(int) ts->sent.tv_sec, (int) ts->sent.tv_usec);

	ts->expire_ev = NULL;
	hevset_remove(tsync_by_time, &ts->sent);

	/*
	 * If we sent the request via UDP, the node is probably UDP-firewalled:
	 * use TCP next time...
	 */

	if (ts->udp) {
		n = node_active_by_id(ts->node_id);
		if (n != NULL)
			n->flags |= NODE_F_TSYNC_TCP;
	}

	tsync_free(ts);
}
Exemple #2
0
/**
 * Called from callout queue when it's time to destroy the record.
 */
static void
val_destroy(cqueue_t *unused_cq, void *obj)
{
	struct used_val *v = obj;

	(void) unused_cq;
	g_assert(v);
	g_assert(is_host_addr(v->addr));

	hevset_remove(used, &v->addr);
	v->cq_ev = NULL;
	val_free(v);
}
Exemple #3
0
/**
 * Free the RPC descriptor.
 */
static void
g2_rpc_free(struct g2_rpc *gr, bool in_shutdown)
{
	g2_rpc_check(gr);

	if (in_shutdown) {
		(*gr->cb)(NULL, NULL, gr->arg);
	} else {
		hevset_remove(g2_rpc_pending, &gr->key);
	}

	cq_cancel(&gr->timeout_ev);
	gr->magic = 0;
	WFREE(gr);
}