gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r34968 - gnunet/src/ats
Date: Thu, 22 Jan 2015 23:35:05 +0100

Author: grothoff
Date: 2015-01-22 23:35:05 +0100 (Thu, 22 Jan 2015)
New Revision: 34968

Modified:
   gnunet/src/ats/gnunet-service-ats.c
   gnunet/src/ats/gnunet-service-ats_addresses.c
   gnunet/src/ats/gnunet-service-ats_addresses.h
   gnunet/src/ats/gnunet-service-ats_performance.c
   gnunet/src/ats/gnunet-service-ats_scheduling.c
Log:
-indentation, do not pass stats arg as const just to then cast the const away

Modified: gnunet/src/ats/gnunet-service-ats.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats.c 2015-01-22 22:22:07 UTC (rev 34967)
+++ gnunet/src/ats/gnunet-service-ats.c 2015-01-22 22:35:05 UTC (rev 34968)
@@ -50,15 +50,16 @@
 
 
 /**
- * We have received a `struct ClientStartMessage` from a client.  Find out 
which
- * type of client it is and notify the respective subsystem.
+ * We have received a `struct ClientStartMessage` from a client.  Find
+ * out which type of client it is and notify the respective subsystem.
  *
  * @param cls closure, unused
  * @param client handle to the client
  * @param message the start message
  */
 static void
-handle_ats_start (void *cls, struct GNUNET_SERVER_Client *client,
+handle_ats_start (void *cls,
+                  struct GNUNET_SERVER_Client *client,
                   const struct GNUNET_MessageHeader *message)
 {
   const struct ClientStartMessage *msg =
@@ -150,7 +151,8 @@
 {
   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
     {&handle_ats_start, NULL,
-     GNUNET_MESSAGE_TYPE_ATS_START, sizeof (struct ClientStartMessage)},
+     GNUNET_MESSAGE_TYPE_ATS_START,
+     sizeof (struct ClientStartMessage)},
     {&GAS_handle_request_address, NULL,
      GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS,
      sizeof (struct RequestAddressMessage)},
@@ -189,10 +191,11 @@
   GAS_performance_init (server, GSA_addresses);
   GAS_scheduling_init (server, GSA_addresses);
 
-  GNUNET_SERVER_disconnect_notify (server, &client_disconnect_handler, NULL);
+  GNUNET_SERVER_disconnect_notify (server,
+                                   &client_disconnect_handler, NULL);
   GNUNET_SERVER_add_handlers (server, handlers);
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &cleanup_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+                                &cleanup_task, NULL);
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2015-01-22 22:22:07 UTC 
(rev 34967)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2015-01-22 22:35:05 UTC 
(rev 34968)
@@ -270,8 +270,10 @@
   void *client;
 };
 
+
 /**
- * Handle for ATS address component
+ * Handle for ATS address component.
+ * FIXME: these should probably all be 'static's instead.
  */
 struct GAS_Addresses_Handle
 {
@@ -635,7 +637,7 @@
                                              peer,
                                              &compare_address_it, &cac);
 
-  if (cac.exact_address == NULL)
+  if (NULL == cac.exact_address)
     return cac.base_address;
   return cac.exact_address;
 }
@@ -819,7 +821,7 @@
 
   /* Get existing address or address with session == 0 */
   existing_address = find_equivalent_address (handle, peer, new_address);
-  if (existing_address == NULL)
+  if (NULL == existing_address)
   {
     /* Add a new address */
     new_address->t_added = GNUNET_TIME_absolute_get();
@@ -862,6 +864,7 @@
     return;
   }
 
+  /* FIXME: this case should probably not be allowed... */
   /* We have an existing address we can use, clean up new */
   GNUNET_free(new_address->plugin);
   GNUNET_free_non_null(new_address->atsi);
@@ -1172,8 +1175,10 @@
 {
   struct GAS_Addresses_Suggestion_Requests *cur = 
handle->pending_requests_head;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received request: `%s' for peer %s\n",
-      "request_address_cancel", GNUNET_i2s (peer));
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Received request: `%s' for peer %s\n",
+             "request_address_cancel",
+             GNUNET_i2s (peer));
 
   while (NULL != cur)
   {
@@ -1191,9 +1196,12 @@
   }
   handle->env.sf.s_get_stop (handle->solver, peer);
   GAS_addresses_handle_backoff_reset (handle, peer);
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Removed request pending for peer `%s\n",
-      GNUNET_i2s (peer));
-  GNUNET_CONTAINER_DLL_remove(handle->pending_requests_head, 
handle->pending_requests_tail, cur);
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Removed request pending for peer `%s\n",
+             GNUNET_i2s (peer));
+  GNUNET_CONTAINER_DLL_remove (handle->pending_requests_head,
+                               handle->pending_requests_tail,
+                               cur);
   GNUNET_free(cur);
 }
 
@@ -1211,8 +1219,10 @@
   struct GAS_Addresses_Suggestion_Requests *cur = 
handle->pending_requests_head;
   struct ATS_Address *aa;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
-      "REQUEST ADDRESS", GNUNET_i2s (peer));
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+             "Received `%s' for peer `%s'\n",
+             "REQUEST ADDRESS",
+             GNUNET_i2s (peer));
 
   if (GNUNET_NO == handle->running)
     return;
@@ -1316,7 +1326,6 @@
  * @param stat operation status
  * @param add additional information
  */
-
 static void
 solver_info_cb (void *cls,
     enum GAS_Solver_Operation op,
@@ -1436,11 +1445,11 @@
  * @param prop_rel the new relative preference value
  */
 static void
-normalized_property_changed_cb (void *cls, struct ATS_Address *address,
-    uint32_t type, double prop_rel)
+normalized_property_changed_cb (void *cls,
+                                struct ATS_Address *address,
+                                uint32_t type, double prop_rel)
 {
-  struct GAS_Addresses_Handle *ah = (struct GAS_Addresses_Handle *) cls;
-  GNUNET_assert(NULL != ah);
+  struct GAS_Addresses_Handle *ah = cls;
 
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
       "Normalized property %s for peer `%s' changed to %.3f \n",
@@ -1450,6 +1459,7 @@
   ah->env.sf.s_address_update_property (ah->solver, address, type, 0, 
prop_rel);
 }
 
+
 static struct GAS_Addresses_Preference_Clients *
 find_preference_client (struct GAS_Addresses_Handle *handle, void *client)
 {
@@ -1474,7 +1484,8 @@
 GAS_addresses_preference_client_disconnect (struct GAS_Addresses_Handle 
*handle,
                                             void *client)
 {
-  struct GAS_Addresses_Preference_Clients * pc;
+  struct GAS_Addresses_Preference_Clients *pc;
+
   if (NULL != (pc = find_preference_client (handle, client)))
   {
     GNUNET_CONTAINER_DLL_remove (handle->preference_clients_head,
@@ -1482,7 +1493,10 @@
     GNUNET_free (pc);
     GNUNET_assert (handle->pref_clients > 0);
     handle->pref_clients --;
-    GNUNET_STATISTICS_set (handle->stat, "# active performance clients", 
handle->pref_clients, GNUNET_NO);
+    GNUNET_STATISTICS_set (handle->stat,
+                           "# active performance clients",
+                           handle->pref_clients,
+                           GNUNET_NO);
   }
   GAS_normalization_preference_client_disconnect (client);
 }
@@ -1502,7 +1516,8 @@
     void *client, const struct GNUNET_PeerIdentity *peer,
     enum GNUNET_ATS_PreferenceKind kind, float score_abs)
 {
-  struct GAS_Addresses_Preference_Clients * pc;
+  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);
@@ -1559,8 +1574,10 @@
                                    float score_abs)
 {
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Received `%s' for peer `%s' for client %p\n", "PREFERENCE FEEDBACK",
-      GNUNET_i2s (peer), application);
+             "Received `%s' for peer `%s' for client %p\n",
+             "PREFERENCE FEEDBACK",
+             GNUNET_i2s (peer),
+             application);
 
   if (GNUNET_NO == handle->running)
     return;
@@ -1811,7 +1828,7 @@
  */
 struct GAS_Addresses_Handle *
 GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                    const struct GNUNET_STATISTICS_Handle *stats)
+                    struct GNUNET_STATISTICS_Handle *stats)
 {
   struct GAS_Addresses_Handle *ah;
   unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount];
@@ -1823,7 +1840,7 @@
   ah = GNUNET_new (struct GAS_Addresses_Handle);
   ah->running = GNUNET_NO;
 
-  ah->stat = (struct GNUNET_STATISTICS_Handle *) stats;
+  ah->stat = stats;
   /* Initialize the addresses database */
   ah->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
   ah->pref_clients = 0;
@@ -1943,8 +1960,10 @@
   /* up and running */
   ah->running = GNUNET_YES;
 
-  GNUNET_STATISTICS_set (ah->stat, "# addresses",
-      GNUNET_CONTAINER_multipeermap_size (ah->addresses), GNUNET_NO);
+  GNUNET_STATISTICS_set (ah->stat,
+                         "# addresses",
+                         GNUNET_CONTAINER_multipeermap_size (ah->addresses),
+                         GNUNET_NO);
 
   return ah;
 }

Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h       2015-01-22 22:22:07 UTC 
(rev 34967)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h       2015-01-22 22:35:05 UTC 
(rev 34968)
@@ -424,7 +424,7 @@
  */
 struct GAS_Addresses_Handle *
 GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                    const struct GNUNET_STATISTICS_Handle *stats);
+                    struct GNUNET_STATISTICS_Handle *stats);
 
 
 /**

Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c     2015-01-22 22:22:07 UTC 
(rev 34967)
+++ gnunet/src/ats/gnunet-service-ats_performance.c     2015-01-22 22:35:05 UTC 
(rev 34968)
@@ -619,7 +619,8 @@
   uint32_t nump;
   uint32_t i;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "PREFERENCE_CHANGE");
   msize = ntohs (message->size);
   if (msize < sizeof (struct ChangePreferenceMessage))

Modified: gnunet/src/ats/gnunet-service-ats_scheduling.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.c      2015-01-22 22:22:07 UTC 
(rev 34967)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.c      2015-01-22 22:35:05 UTC 
(rev 34968)
@@ -162,7 +162,8 @@
   const struct RequestAddressMessage *msg =
       (const struct RequestAddressMessage *) message;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "REQUEST_ADDRESS_CANCEL");
   GNUNET_break (0 == ntohl (msg->reserved));
 




reply via email to

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