gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33671 - gnunet/src/ats
Date: Mon, 16 Jun 2014 10:38:55 +0200

Author: grothoff
Date: 2014-06-16 10:38:55 +0200 (Mon, 16 Jun 2014)
New Revision: 33671

Modified:
   gnunet/src/ats/gnunet-service-ats_scheduling.c
   gnunet/src/ats/gnunet-service-ats_scheduling.h
Log:
-doxygen, indentation, nicer stats

Modified: gnunet/src/ats/gnunet-service-ats_scheduling.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.c      2014-06-16 08:31:34 UTC 
(rev 33670)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.c      2014-06-16 08:38:55 UTC 
(rev 33671)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2011 Christian Grothoff (and other contributing authors)
+     (C) 2011-2014 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -41,17 +41,17 @@
  */
 static struct GNUNET_SERVER_Client *my_client;
 
-
 /**
  * Handle to address subsystem
  */
 static struct GAS_Addresses_Handle *address_handle;
 
+
 /**
  * Register a new scheduling client.
  *
  * @param client handle of the new client
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GAS_scheduling_add_client (struct GNUNET_SERVER_Client *client)
@@ -91,26 +91,25 @@
  * @param peer peer for which this is an address suggestion
  * @param plugin_name 0-termintated string specifying the transport plugin
  * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in plugin_addr
+ * @param plugin_addr_len number of bytes in @a plugin_addr
  * @param local_address_info the local address for the address
  * @param session_id session ID to use for the given client (other clients 
will see 0)
  * @param atsi performance data for the address
- * @param atsi_count number of performance records in 'ats'
+ * @param atsi_count number of performance records in @a atsi
  * @param bandwidth_out assigned outbound bandwidth
  * @param bandwidth_in assigned inbound bandwidth
  */
 void
-GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
-                                *peer,
-                                const char *plugin_name,
-                                const void *plugin_addr,
-                                size_t plugin_addr_len,
-                                uint32_t local_address_info,
-                                uint32_t session_id,
-                                const struct GNUNET_ATS_Information *atsi,
-                                uint32_t atsi_count,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
+GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity 
*peer,
+                                            const char *plugin_name,
+                                            const void *plugin_addr,
+                                            size_t plugin_addr_len,
+                                            uint32_t local_address_info,
+                                            uint32_t session_id,
+                                            const struct 
GNUNET_ATS_Information *atsi,
+                                            uint32_t atsi_count,
+                                            struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                                            struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
 {
   struct AddressSuggestionMessage *msg;
   size_t plugin_name_length = strlen (plugin_name) + 1;
@@ -166,7 +165,8 @@
  * @param message the request message
  */
 void
-GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_request_address (void *cls,
+                            struct GNUNET_SERVER_Client *client,
                             const struct GNUNET_MessageHeader *message)
 {
   const struct RequestAddressMessage *msg =
@@ -204,6 +204,7 @@
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
+
 /**
  * Handle 'reset backoff' messages from clients.
  *
@@ -219,13 +220,15 @@
   const struct ResetBackoffMessage *msg =
       (const struct ResetBackoffMessage *) message;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "RESET_BACKOFF");
   GNUNET_break (0 == ntohl (msg->reserved));
   GAS_addresses_handle_backoff_reset (address_handle, &msg->peer);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
+
 /**
  * Handle 'address add' messages from clients.
  *
@@ -234,7 +237,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_add (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_add (void *cls,
+                        struct GNUNET_SERVER_Client *client,
                         const struct GNUNET_MessageHeader *message)
 {
   const struct AddressUpdateMessage *m;
@@ -246,7 +250,8 @@
   uint32_t ats_count;
   uint16_t size;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "ADDRESS_ADD");
   size = ntohs (message->size);
   if (size < sizeof (struct AddressUpdateMessage))
@@ -277,10 +282,17 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STATISTICS_update (GSA_stats, "# address updates received", 1,
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# addresses created", 1,
                             GNUNET_NO);
-  GAS_addresses_add (address_handle, &m->peer, plugin_name, address, 
address_length,
-      ntohl(m->address_local_info), ntohl (m->session_id), atsi, ats_count);
+  GAS_addresses_add (address_handle,
+                     &m->peer,
+                     plugin_name,
+                     address,
+                     address_length,
+                     ntohl(m->address_local_info),
+                     ntohl (m->session_id),
+                     atsi, ats_count);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
@@ -293,7 +305,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_update (void *cls,
+                           struct GNUNET_SERVER_Client *client,
                            const struct GNUNET_MessageHeader *message)
 {
   const struct AddressUpdateMessage *m;
@@ -305,7 +318,8 @@
   uint32_t ats_count;
   uint16_t size;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message\n",
               "ADDRESS_UPDATE");
   size = ntohs (message->size);
   if (size < sizeof (struct AddressUpdateMessage))
@@ -336,9 +350,15 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STATISTICS_update (GSA_stats, "# address updates received", 1,
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# address updates received",
+                            1,
                             GNUNET_NO);
-  GAS_addresses_update (address_handle, &m->peer, plugin_name, address, 
address_length,
+  GAS_addresses_update (address_handle,
+                        &m->peer,
+                        plugin_name,
+                        address,
+                        address_length,
                         ntohl (m->address_local_info),
                         ntohl (m->session_id), atsi, ats_count);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -353,7 +373,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_in_use (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_in_use (void *cls,
+                           struct GNUNET_SERVER_Client *client,
                            const struct GNUNET_MessageHeader *message)
 {
   const struct AddressUseMessage *m;
@@ -362,7 +383,6 @@
   int res;
   uint16_t address_length;
   uint16_t plugin_name_length;
-
   uint16_t size;
   uint16_t in_use;
 
@@ -404,16 +424,16 @@
                               ntohl (m->session_id),
                               in_use);
 
-  if (res == GNUNET_OK)
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  else
+  if (GNUNET_OK != res)
   {
     GNUNET_break (0);
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
   }
-
+  GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
+
 /**
  * Handle 'address destroyed' messages from clients.
  *
@@ -422,7 +442,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_destroyed (void *cls,
+                              struct GNUNET_SERVER_Client *client,
                               const struct GNUNET_MessageHeader *message)
 {
   const struct AddressDestroyedMessage *m;
@@ -433,8 +454,10 @@
   uint16_t plugin_name_length;
   uint16_t size;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message of size %u %u\n",
-              "ADDRESS_DESTROYED", ntohs (message->size),
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received `%s' message of size %u %u\n",
+              "ADDRESS_DESTROYED",
+              ntohs (message->size),
               sizeof (struct AddressDestroyedMessage));
   size = ntohs (message->size);
   if ((size < sizeof (struct AddressDestroyedMessage)) || (client != 
my_client))
@@ -466,7 +489,10 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  GNUNET_STATISTICS_update (GSA_stats, "# addresses destroyed", 1, GNUNET_NO);
+  GNUNET_STATISTICS_update (GSA_stats,
+                            "# addresses destroyed",
+                            1,
+                            GNUNET_NO);
   GAS_addresses_destroy (address_handle, &m->peer, plugin_name,
                          address, address_length,
                          ntohl (m->address_local_info),
@@ -491,7 +517,8 @@
  * @param ah the address handle to use
  */
 void
-GAS_scheduling_init (struct GNUNET_SERVER_Handle *server, struct 
GAS_Addresses_Handle *ah)
+GAS_scheduling_init (struct GNUNET_SERVER_Handle *server,
+                     struct GAS_Addresses_Handle *ah)
 {
   GNUNET_assert (NULL != ah);
   address_handle = ah;
@@ -511,7 +538,6 @@
   }
   GNUNET_SERVER_notification_context_destroy (nc);
   nc = NULL;
-
 }
 
 

Modified: gnunet/src/ats/gnunet-service-ats_scheduling.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_scheduling.h      2014-06-16 08:31:34 UTC 
(rev 33670)
+++ gnunet/src/ats/gnunet-service-ats_scheduling.h      2014-06-16 08:38:55 UTC 
(rev 33671)
@@ -34,7 +34,7 @@
  * Register a new scheduling client.
  *
  * @param client handle of the new client
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GAS_scheduling_add_client (struct GNUNET_SERVER_Client *client);
@@ -79,17 +79,16 @@
  * @param bandwidth_in assigned inbound bandwidth
  */
 void
-GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
-                                *peer,
-                                const char *plugin_name,
-                                const void *plugin_addr,
-                                size_t plugin_addr_len,
-                                uint32_t local_address_info,
-                                uint32_t session_id,
-                                const struct GNUNET_ATS_Information *atsi,
-                                uint32_t atsi_count,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
+GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity 
*peer,
+                                            const char *plugin_name,
+                                            const void *plugin_addr,
+                                            size_t plugin_addr_len,
+                                            uint32_t local_address_info,
+                                            uint32_t session_id,
+                                            const struct 
GNUNET_ATS_Information *atsi,
+                                            uint32_t atsi_count,
+                                            struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out,
+                                            struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in);
 
 
 /**
@@ -100,7 +99,8 @@
  * @param message the request message
  */
 void
-GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_request_address (void *cls,
+                            struct GNUNET_SERVER_Client *client,
                             const struct GNUNET_MessageHeader *message);
 
 
@@ -125,9 +125,11 @@
  * @param message the request message
  */
 void
-GAS_handle_address_add (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_add (void *cls,
+                        struct GNUNET_SERVER_Client *client,
                         const struct GNUNET_MessageHeader *message);
 
+
 /**
  * Handle 'address update' messages from clients.
  *
@@ -136,7 +138,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_update (void *cls,
+                           struct GNUNET_SERVER_Client *client,
                            const struct GNUNET_MessageHeader *message);
 
 
@@ -148,7 +151,8 @@
  * @param message the request message
  */
 void
-GAS_handle_address_in_use (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_address_in_use (void *cls,
+                           struct GNUNET_SERVER_Client *client,
                            const struct GNUNET_MessageHeader *message);
 
 
@@ -172,7 +176,8 @@
  * @param ah the address handle to use
  */
 void
-GAS_scheduling_init (struct GNUNET_SERVER_Handle *server, struct 
GAS_Addresses_Handle *ah);
+GAS_scheduling_init (struct GNUNET_SERVER_Handle *server,
+                     struct GAS_Addresses_Handle *ah);
 
 
 /**




reply via email to

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