[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14868 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14868 - gnunet/src/transport |
Date: |
Tue, 5 Apr 2011 14:45:58 +0200 |
Author: wachs
Date: 2011-04-05 14:45:58 +0200 (Tue, 05 Apr 2011)
New Revision: 14868
Modified:
gnunet/src/transport/gnunet-service-transport.c
Log:
clean up
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2011-04-05 11:59:03 UTC
(rev 14867)
+++ gnunet/src/transport/gnunet-service-transport.c 2011-04-05 12:45:58 UTC
(rev 14868)
@@ -973,7 +973,7 @@
static void try_transmission_to_peer (struct NeighbourList *n);
-struct ATS_info * ats_init ();
+void ats_init ();
void ats_shutdown ( );
@@ -5657,7 +5657,7 @@
struct ATS_info
{
- struct GNUNET_CONTAINER_MultiHashMap * peers;
+
/**
* Time of last execution
*/
@@ -6336,33 +6336,9 @@
&ats_schedule_calculation, ats);
}
-
-int ats_map_remove_peer (void *cls,
- const GNUNET_HashCode * key,
- void *value)
+void ats_init ()
{
-
- 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 ()
-{
- 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;
@@ -6378,6 +6354,7 @@
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);
@@ -6411,8 +6388,6 @@
}
ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation,
ats);
-
- return ats;
}
@@ -6443,8 +6418,6 @@
p = ats->head;
}
- GNUNET_CONTAINER_multihashmap_iterate
(ats->peers,ats_map_remove_peer,NULL);
- GNUNET_CONTAINER_multihashmap_destroy (ats->peers);
GNUNET_free (ats);
}
@@ -6465,14 +6438,6 @@
#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);
}
@@ -6482,13 +6447,6 @@
#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);
}
@@ -6648,7 +6606,7 @@
if (no_transports)
refresh_hello ();
- ats = ats_init();
+ ats_init();
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Transport service ready.\n"));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14868 - gnunet/src/transport,
gnunet <=