Ejemplo n.º 1
0
/**
 * Register callback to read from the SOCKS5 proxy.
 *
 * @param client the service
 * @param handler function to call with the message
 * @param handler_cls closure for @a handler
 */
void
register_reciever (struct GNUNET_SOCKS_Handshake *ih, int want)
{
  GNUNET_CONNECTION_receive (ih->socks5_connection,
                             want,
                             GNUNET_TIME_relative_get_minute_ (),
                             &reciever,
                             ih);
}
Ejemplo n.º 2
0
/**
 * @brief This function initiates the transmission of the next message.
 *
 * \latexonly \\ \\ \endlatexonly
 * \em Detailed \em description \n
 * This function initiates the transmission of the next message. In order to do that it dequeues the message from the
 * output queue and calls the appropriate GNUnet function for the transmission of the message. The function is implemented as a GNUnet task; this is done in order to decouple it from the
 * transmit_ready() function call (see above).
 *
 * @param cls the GNUnet closure (not used)
 * @param tc the GNUnet task context (not used)
 */
static void gnunet_search_flooding_transmit_next(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) {
	if(!queue_get_length(gnunet_search_flooding_message_queue))
		return;

	struct gnunet_search_flooding_queued_message *msg = (struct gnunet_search_flooding_queued_message*) queue_dequeue(
			gnunet_search_flooding_message_queue);

	struct GNUNET_TIME_Relative max_delay = GNUNET_TIME_relative_get_minute_();
	struct GNUNET_TIME_Relative gct = GNUNET_TIME_relative_add(max_delay, GNUNET_TIME_relative_get_second_());

	GNUNET_CORE_notify_transmit_ready(gnunet_search_flooding_core_handle, 0, 0, max_delay, msg->peer, msg->size,
			&gnunet_search_flooding_notify_transmit_ready, msg->buffer);

	/*
	 * Todo: Save and free...
	 */
	GNUNET_SCHEDULER_add_delayed(gct, &gnunet_search_flooding_queued_message_free_task, msg);
}