/*
This file is part of GNUnet.
- (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+ (C) 2009-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
*/
#define TYPEMAP_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
+/**
+ * How often do we transmit our typemap on first attempt?
+ */
+#define TYPEMAP_FREQUENCY_FIRST GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+
/**
* Message ready for encryption. This struct is followed by the
if (0 == session->first_typemap)
{
- delay = GNUNET_TIME_UNIT_ZERO;
+ delay = TYPEMAP_FREQUENCY_FIRST;
session->first_typemap = 1;
}
else
delay = TYPEMAP_FREQUENCY;
}
/* randomize a bit to avoid spont. sync */
- delay.rel_value +=
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000);
+ delay.rel_value_us +=
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000 * 1000);
session->typemap_task =
GNUNET_SCHEDULER_add_delayed (delay, &transmit_typemap_task, session);
GNUNET_STATISTICS_update (GSC_stats,
{
pos = nxt;
nxt = pos->next;
- if ((pos->deadline.abs_value < now.abs_value) &&
+ if ((pos->deadline.abs_value_us < now.abs_value_us) &&
(GNUNET_YES != pos->was_solicited))
{
GNUNET_STATISTICS_update (GSC_stats,
now = GNUNET_TIME_absolute_get ();
if ((msize == 0) ||
((msize < GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE / 2) &&
- (min_deadline.abs_value > now.abs_value)))
+ (min_deadline.abs_value_us > now.abs_value_us)))
{
/* not enough ready yet, try to solicit more */
solicit_messages (session);
/* FIXME: code duplication with clients... */
cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
- // FIXME: full ats...
- cnm.ats_count = htonl (0);
cnm.peer = session->peer;
GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header);
return GNUNET_OK;