gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35113 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r35113 - gnunet/src/ats
Date: Thu, 5 Feb 2015 21:04:08 +0100

Author: grothoff
Date: 2015-02-05 21:04:08 +0100 (Thu, 05 Feb 2015)
New Revision: 35113

Modified:
   gnunet/src/ats/gnunet-service-ats.c
   gnunet/src/ats/gnunet-service-ats_preferences.c
   gnunet/src/ats/gnunet-service-ats_preferences.h
Log:
dead code elimination

Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2015-02-05 19:58:37 UTC (rev 35112)
+++ gnunet/src/ats/gnunet-service-ats.c 2015-02-05 20:04:08 UTC (rev 35113)
@@ -112,7 +112,6 @@
   GAS_scheduling_remove_client (client);
   GAS_connectivity_remove_client (client);
   GAS_normalization_preference_client_disconnect (client);
-  GAS_preference_client_disconnect (client);
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_preferences.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_preferences.c     2015-02-05 19:58:37 UTC 
(rev 35112)
+++ gnunet/src/ats/gnunet-service-ats_preferences.c     2015-02-05 20:04:08 UTC 
(rev 35113)
@@ -19,7 +19,7 @@
 */
 /**
  * @file ats/gnunet-service-ats_preferences.c
- * @brief ats service, interaction with 'performance' API
+ * @brief manage preferences expressed by clients
  * @author Matthias Wachs
  * @author Christian Grothoff
  */
@@ -35,7 +35,9 @@
 #define LOG(kind,...) GNUNET_log_from (kind, "ats-preferencesx",__VA_ARGS__)
 
 #define PREF_AGING_INTERVAL GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 10)
+
 #define PREF_AGING_FACTOR 0.95
+
 #define PREF_EPSILON 0.01
 
 
@@ -50,50 +52,13 @@
   double f_rel[GNUNET_ATS_PreferenceCount];
 
   /**
-   * Peer id
+   * Peer identity for which we have these preferences.
    */
   struct GNUNET_PeerIdentity id;
 };
 
 
 /**
- * FIXME
- */
-struct GAS_Addresses_Preference_Clients
-{
-  /**
-   * Next in DLL
-   */
-  struct GAS_Addresses_Preference_Clients *next;
-
-  /**
-   * Previous in DLL
-   */
-  struct GAS_Addresses_Preference_Clients *prev;
-
-  /**
-   * Peer ID
-   */
-  void *client;
-};
-
-
-/**
- * Preference requests DLL head
- */
-static struct GAS_Addresses_Preference_Clients *preference_clients_head;
-
-/**
- * Preference requests DLL head
- */
-static struct GAS_Addresses_Preference_Clients *preference_clients_tail;
-
-/**
- * Preferences clients
- */
-static int pref_clients;
-
-/**
  * Default values
  */
 static struct PeerRelative defvalues;
@@ -204,20 +169,6 @@
 static struct GNUNET_SCHEDULER_Task * aging_task;
 
 
-
-
-static struct GAS_Addresses_Preference_Clients *
-find_preference_client (struct GNUNET_SERVER_Client *client)
-{
-  struct GAS_Addresses_Preference_Clients *cur;
-
-  for (cur = preference_clients_head; NULL != cur; cur = cur->next)
-    if (cur->client == client)
-      return cur;
-  return NULL;
-}
-
-
 /**
  * Update a peer
  *
@@ -479,35 +430,7 @@
 
 
 
-
-
 /**
- * A performance client disconnected
- *
- * @param client the client
- */
-void
-GAS_preference_client_disconnect (struct GNUNET_SERVER_Client *client)
-{
-  struct GAS_Addresses_Preference_Clients *pc;
-
-  if (NULL != (pc = find_preference_client (client)))
-  {
-    GNUNET_CONTAINER_DLL_remove (preference_clients_head,
-                                 preference_clients_tail,
-                                 pc);
-    GNUNET_free (pc);
-    GNUNET_assert (pref_clients > 0);
-    pref_clients --;
-    GNUNET_STATISTICS_set (GSA_stats,
-                           "# active performance clients",
-                           pref_clients,
-                           GNUNET_NO);
-  }
-}
-
-
-/**
  * Change the preference for a peer
  *
  * @param client the client sending this request
@@ -521,36 +444,22 @@
                     enum GNUNET_ATS_PreferenceKind kind,
                     float score_abs)
 {
-  struct GAS_Addresses_Preference_Clients *pc;
-
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Received `%s' for peer `%s' for client %p\n", "CHANGE PREFERENCE",
-      GNUNET_i2s (peer), client);
-
   if (GNUNET_NO ==
       GNUNET_CONTAINER_multipeermap_contains (GSA_addresses,
                                              peer))
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-        "Received `%s' for unknown peer `%s' from client %p\n",
-        "CHANGE PREFERENCE", GNUNET_i2s (peer), client);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received CHANGE_PREFERENCE for unknown peer `%s'\n",
+                GNUNET_i2s (peer));
     return;
   }
-
-  if (NULL == find_preference_client (client))
-  {
-    pc = GNUNET_new (struct GAS_Addresses_Preference_Clients);
-    pc->client = client;
-    GNUNET_CONTAINER_DLL_insert (preference_clients_head,
-                                 preference_clients_tail,
-                                 pc);
-    pref_clients ++;
-    GNUNET_STATISTICS_set (GSA_stats,
-                           "# active performance clients",
-                           pref_clients,
-                           GNUNET_NO);
-  }
-  GAS_plugin_update_preferences (client, peer, kind, score_abs);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received CHANGE_PREFERENCE for peer `%s'\n",
+              GNUNET_i2s (peer));
+  GAS_plugin_update_preferences (client,
+                                 peer,
+                                 kind,
+                                 score_abs);
 }
 
 
@@ -669,7 +578,6 @@
 void
 GAS_preference_done ()
 {
-  struct GAS_Addresses_Preference_Clients *pcur;
   struct PreferenceClient *pc;
   struct PreferenceClient *next_pc;
 
@@ -690,19 +598,6 @@
                                          NULL);
   GNUNET_CONTAINER_multipeermap_destroy (preference_peers);
 
-  while (NULL != (pcur = preference_clients_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (preference_clients_head,
-                                 preference_clients_tail,
-                                 pcur);
-    GNUNET_assert (pref_clients > 0);
-    pref_clients --;
-    GNUNET_STATISTICS_set (GSA_stats,
-                           "# active performance clients",
-                           pref_clients,
-                           GNUNET_NO);
-    GNUNET_free (pcur);
-  }
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_preferences.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_preferences.h     2015-02-05 19:58:37 UTC 
(rev 35112)
+++ gnunet/src/ats/gnunet-service-ats_preferences.h     2015-02-05 20:04:08 UTC 
(rev 35113)
@@ -17,10 +17,9 @@
  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.
  */
-
 /**
  * @file ats/gnunet-service-ats_preferences.h
- * @brief FIXME
+ * @brief manage preferences expressed by clients
  * @author Matthias Wachs
  * @author Christian Grothoff
  */
@@ -40,15 +39,6 @@
 
 
 /**
- * A preference client disconnected.
- *
- * @param client the client
- */
-void
-GAS_preference_client_disconnect (struct GNUNET_SERVER_Client *client);
-
-
-/**
  * Get the normalized preference values for a specific peer.
  *
  * @param cls ignored




reply via email to

[Prev in Thread] Current Thread [Next in Thread]