#include "gnunet_hello_lib.h"
#include "gnunet_peerinfo_service.h"
#include "gnunet_crypto_lib.h"
+#include "gnunet_statistics_service.h"
#include "dv.h"
/**
*/
static struct GNUNET_CONTAINER_Heap *neighbor_max_heap;
+/**
+ * Handle for the statistics service.
+ */
+struct GNUNET_STATISTICS_Handle *stats;
+
/**
* How far out to keep peers we learn about.
*/
memcpy (&toSend[1], message, message_size);
if ((source != NULL) && (source->pkey == NULL)) /* Test our hypothesis about message failures! */
{
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s: Sending message, but anticipate recipient will not know sender!!!\n\n\n");
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s: Sending message, but anticipate recipient will not know sender!!!\n\n\n", my_short_id);
}
GNUNET_CONTAINER_DLL_insert_after (core_pending_head,
core_pending_tail,
{
#if DEBUG_DV_MESSAGES
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s: unknown sender (%u), Message uid %llu from %s!\n", my_short_id, ntohl(incoming->sender), ntohl(incoming->uid), GNUNET_i2s(&dn->identity));
+ "%s: unknown sender (%u), Message uid %u from %s!\n", my_short_id, ntohl(incoming->sender), ntohl(incoming->uid), GNUNET_i2s(&dn->identity));
pos = dn->referee_head;
while ((NULL != pos) && (pos->referrer_id != sid))
{
}
#endif
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s: unknown sender (%u), Message uid %llu from %s!\n", my_short_id, ntohl(incoming->sender), ntohl(incoming->uid), GNUNET_i2s(&dn->identity));
+ "%s: unknown sender (%u), Message uid %u from %s!\n", my_short_id, ntohl(incoming->sender), ntohl(incoming->uid), GNUNET_i2s(&dn->identity));
found_pos = -1;
for (i = 0; i< MAX_OUTSTANDING_MESSAGES; i++)
if (distant->referrer_id == ntohl(enc_message->peer_id))
{
distant_neighbor_free(distant);
+ distant = referrer->referee_head;
}
- distant = referrer->referee_head;
+ else
+ distant = distant->next;
}
return GNUNET_OK;
* @param cls closure
* @param peer id of the peer, NULL for last call
* @param hello hello message for the peer (can be NULL)
- * @param trust amount of trust we have in the peer
*/
static void
process_peerinfo (void *cls,
const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Message *hello, uint32_t trust)
+ const struct GNUNET_HELLO_Message *hello)
{
struct PeerIteratorContext *peerinfo_iterator = cls;
struct DirectNeighbor *neighbor = peerinfo_iterator->neighbor;
#endif
peerinfo_iterator->ic = GNUNET_PEERINFO_iterate(peerinfo_handle,
&peerinfo_iterator->neighbor->identity,
- 0,
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3),
&process_peerinfo,
peerinfo_iterator);
}
sent = GNUNET_CONTAINER_multihashmap_iterate (extended_neighbors, &add_all_extended_peers, neighbor->send_context);
-
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_update (stats, "# distant peers gossiped to direct neighbors", sent, GNUNET_NO);
+ }
#if DEBUG_DV_PEER_NUMBERS
neighbor_pid = GNUNET_strdup(GNUNET_i2s(&neighbor->identity));
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped %d extended peers to %s\n", GNUNET_i2s(&my_identity), sent, neighbor_pid);
#endif
sent = GNUNET_CONTAINER_multihashmap_iterate (direct_neighbors, &add_all_direct_neighbors, neighbor);
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_update (stats, "# direct peers gossiped to direct neighbors", sent, GNUNET_NO);
+ }
#if DEBUG_DV_PEER_NUMBERS
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Gossipped about %s to %d direct peers\n", GNUNET_i2s(&my_identity), neighbor_pid, sent);
GNUNET_free(neighbor_pid);
peerinfo_iterator->neighbor = neighbor;
peerinfo_iterator->ic = GNUNET_PEERINFO_iterate (peerinfo_handle,
peer,
- 0,
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3),
&process_peerinfo,
peerinfo_iterator);
{
about = GNUNET_CONTAINER_multihashmap_get(extended_neighbors, &peer->hashPubKey);
if ((GNUNET_CONTAINER_multihashmap_get(direct_neighbors, &peer->hashPubKey) == NULL) && (about != NULL))
- sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about);
+ {
+ sent = GNUNET_CONTAINER_multihashmap_iterate(direct_neighbors, &add_distant_all_direct_neighbors, about);
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_update (stats, "# direct peers gossiped to new direct neighbors", sent, GNUNET_NO);
+ }
+ }
#if DEBUG_DV
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"%s: Distance (%d) greater than %d or already know about peer (%s), not re-adding!\n", "dv", distance, DIRECT_NEIGHBOR_COST, GNUNET_i2s(peer));
&core_init,
&handle_core_connect,
&handle_core_disconnect,
+ NULL,
NULL,
GNUNET_NO,
NULL,