clean up
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 5 Apr 2011 12:45:58 +0000 (12:45 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 5 Apr 2011 12:45:58 +0000 (12:45 +0000)
src/transport/gnunet-service-transport.c

index 1128c7d9448eac21bd98b94d72b0f190d75978d1..0b7524bbc73d8f2aa23891d80b14c6cd826bc3cb 100644 (file)
@@ -973,7 +973,7 @@ static void disconnect_neighbour (struct NeighbourList *n, int check);
 static void try_transmission_to_peer (struct NeighbourList *n);
 
 
-struct ATS_info * ats_init ();
+void ats_init ();
 
 void ats_shutdown ( );
 
@@ -5657,7 +5657,7 @@ static int available_ressources = 7;
 
 struct ATS_info
 {
-       struct GNUNET_CONTAINER_MultiHashMap * peers;
+
        /**
         * Time of last execution
         */
@@ -6336,33 +6336,9 @@ ats_schedule_calculation (void *cls,
                                        &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;
@@ -6378,6 +6354,7 @@ struct ATS_info * ats_init ()
        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 @@ struct ATS_info * ats_init ()
        }
 
        ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, ats);
-
-       return ats;
 }
 
 
@@ -6443,8 +6418,6 @@ void ats_shutdown ()
                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 @@ void ats_notify_peer_connect (
 #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 @@ void ats_notify_peer_disconnect (
 #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 @@ run (void *cls,
   if (no_transports)
     refresh_hello ();
 
-  ats = ats_init();
+  ats_init();
 
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Transport service ready.\n"));