#include "core.h"
-#define DEBUG_HANDSHAKE GNUNET_NO
+#define DEBUG_HANDSHAKE GNUNET_YES
-#define DEBUG_CORE_QUOTA GNUNET_NO
+#define DEBUG_CORE_QUOTA GNUNET_YES
/**
* Receive and send buffer windows grow over time. For
n->next = neighbours;
neighbours = n;
neighbour_count++;
- GNUNET_STATISTICS_set (stats, gettext_noop ("# active neighbours"), neighbour_count, GNUNET_NO);
+ GNUNET_STATISTICS_set (stats, gettext_noop ("# neighbours entries allocated"), neighbour_count, GNUNET_NO);
n->peer = *pid;
GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key);
now = GNUNET_TIME_absolute_get ();
n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
(uint32_t) - 1);
neighbour_quota_update (n, NULL);
+ consider_free_neighbour (n);
return n;
}
n = find_neighbour (&cm->peer);
if (n == NULL)
n = create_neighbour (&cm->peer);
- if ( (n->is_connected) ||
+ if ( (GNUNET_YES == n->is_connected) ||
(n->th != NULL) )
return; /* already connected, or at least trying */
GNUNET_STATISTICS_update (stats, gettext_noop ("# connection requests received"), 1, GNUNET_NO);
{
#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Forcing disconnect of `%4s' due to inactivity (?).\n",
+ "Forcing disconnect of `%4s' due to inactivity\n",
GNUNET_i2s (&n->peer));
#endif
q_in = GNUNET_BANDWIDTH_value_init (0); /* force disconnect */
if (n->bw_in.value__ != q_in.value__)
{
n->bw_in = q_in;
- GNUNET_TRANSPORT_set_quota (transport,
- &n->peer,
- n->bw_in,
- n->bw_out,
- GNUNET_TIME_UNIT_FOREVER_REL,
- NULL, NULL);
+ if (GNUNET_YES == n->is_connected)
+ GNUNET_TRANSPORT_set_quota (transport,
+ &n->peer,
+ n->bw_in,
+ n->bw_out,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL, NULL);
}
schedule_quota_update (n);
}
n = find_neighbour (peer);
if (n != NULL)
{
- if (n->is_connected)
+ if (GNUNET_YES == n->is_connected)
{
/* duplicate connect notification!? */
GNUNET_break (0);