static void try_transmission_to_peer (struct NeighbourList *n);
-struct ATS_info * ats_init ();
+void ats_init ();
void ats_shutdown ( );
struct ATS_info
{
- struct GNUNET_CONTAINER_MultiHashMap * peers;
+
/**
* Time of last execution
*/
&ats_schedule_calculation, ats);
}
-
-int ats_map_remove_peer (void *cls,
- const GNUNET_HashCode * key,
- void *value)
-{
-
- struct ATS_peer * p = (struct ATS_peer *) value;
-#if DEBUG_ATS
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "map_remove_peer_it: `%s'\n", GNUNET_i2s(&p->peer));
-#endif
- /* cleanup peer */
- GNUNET_free(p);
-
- return GNUNET_YES;
-}
-
-
-
-struct ATS_info * ats_init ()
+void ats_init ()
{
- struct ATS_info * ats;
-#if DEBUG_ATS
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ats_init\n");
-#endif
ats = GNUNET_malloc(sizeof (struct ATS_info));
- ats->peers = GNUNET_CONTAINER_multihashmap_create(10);
- GNUNET_assert(ats->peers!=NULL);
ats->min_delta = ATS_MIN_INTERVAL;
ats->exec_intervall = ATS_EXEC_INTERVAL;
unsigned long long value;
int c = 0;
+
while (cur != NULL)
{
if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Loading resource cost for plugin `%s'\n", cur->short_name);
}
ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, ats);
-
- return ats;
}
p = ats->head;
}
- GNUNET_CONTAINER_multihashmap_iterate (ats->peers,ats_map_remove_peer,NULL);
- GNUNET_CONTAINER_multihashmap_destroy (ats->peers);
GNUNET_free (ats);
}
#endif
c++;
}
- /* check if peer is already known */
- if (!GNUNET_CONTAINER_multihashmap_contains (ats->peers,&peer->hashPubKey))
- {
- struct ATS_peer * p = GNUNET_malloc (sizeof (struct ATS_peer));
- memcpy(&p->peer, peer, sizeof (struct GNUNET_PeerIdentity));
- GNUNET_CONTAINER_multihashmap_put(ats->peers, &p->peer.hashPubKey, p, GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
- }
-
ats_calculate_bandwidth_distribution(ats);
}
#if DEBUG_ATS
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ats_notify_peer_disconnect: %s\n",GNUNET_i2s(peer));
#endif
- /* remove peer */
- if (GNUNET_CONTAINER_multihashmap_contains (ats->peers, &peer->hashPubKey))
- {
- ats_map_remove_peer(NULL, &peer->hashPubKey, GNUNET_CONTAINER_multihashmap_get (ats->peers, &peer->hashPubKey));
- GNUNET_CONTAINER_multihashmap_remove_all (ats->peers, &peer->hashPubKey);
- }
-
ats_calculate_bandwidth_distribution (ats);
}
if (no_transports)
refresh_hello ();
- ats = ats_init();
+ ats_init();
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Transport service ready.\n"));