cleaning
authorChristian Grothoff <christian@grothoff.org>
Fri, 18 Jun 2010 15:02:59 +0000 (15:02 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 18 Jun 2010 15:02:59 +0000 (15:02 +0000)
src/core/gnunet-service-core.c
src/datastore/gnunet-service-datastore.c
src/fs/gnunet-service-fs.c
src/hostlist/gnunet-daemon-hostlist.c
src/hostlist/hostlist-server.c
src/statistics/gnunet-service-statistics.c
src/transport/gnunet-nat-client.c
src/transport/gnunet-service-transport.c

index 34b3511a8b745f6fdf93100335423b06c0b3f57a..7fcb0309408c78c38dfee5114551f6c5136cc6aa 100644 (file)
@@ -668,11 +668,6 @@ static struct GNUNET_PEERINFO_Handle *peerinfo;
  */
 const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-/**
- * Our server.
- */
-static struct GNUNET_SERVER_Handle *server;
-
 /**
  * Transport service.
  */
@@ -3808,13 +3803,13 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *
  * @param cls closure
  * @param s scheduler to use
- * @param serv the initialized server
+ * @param server the initialized server
  * @param c configuration to use
  */
 static void
 run (void *cls,
      struct GNUNET_SCHEDULER_Handle *s,
-     struct GNUNET_SERVER_Handle *serv,
+     struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
@@ -3880,7 +3875,6 @@ run (void *cls,
   GNUNET_CRYPTO_hash (&my_public_key,
                       sizeof (my_public_key), &my_identity.hashPubKey);
   /* setup notification */
-  server = serv;
   notifier = GNUNET_SERVER_notification_context_create (server, 
                                                        MAX_NOTIFY_QUEUE);
   GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
index ddab5cdf39d179545ce7e6ec96d30cd49caac6b2..faae1ae9924e38cfe9b48365b1fcb41b10585a87 100644 (file)
@@ -124,11 +124,6 @@ static struct ReservationList *reservations;
  */
 static struct GNUNET_CONTAINER_BloomFilter *filter;
 
-/**
- * Static counter to produce reservation identifiers.
- */
-static int reservation_gen;
-
 /**
  * How much space are we allowed to use?
  */
@@ -717,6 +712,11 @@ handle_reserve (void *cls,
                struct GNUNET_SERVER_Client *client,
                const struct GNUNET_MessageHeader *message)
 {
+  /**
+   * Static counter to produce reservation identifiers.
+   */
+  static int reservation_gen;
+
   const struct ReserveMessage *msg = (const struct ReserveMessage*) message;
   struct ReservationList *e;
   unsigned long long used;
index 90d0cabaf288dee002d01ddda57bd4d96dc87349..1c542386c644c1c419b91b7f12a13d8ad4995dff 100644 (file)
@@ -3414,38 +3414,6 @@ handle_start_search (void *cls,
 
 /* **************************** Startup ************************ */
 
-
-/**
- * List of handlers for P2P messages
- * that we care about.
- */
-static struct GNUNET_CORE_MessageHandler p2p_handlers[] =
-  {
-    { &handle_p2p_get, 
-      GNUNET_MESSAGE_TYPE_FS_GET, 0 },
-    { &handle_p2p_put, 
-      GNUNET_MESSAGE_TYPE_FS_PUT, 0 },
-    { NULL, 0, 0 }
-  };
-
-
-/**
- * List of handlers for the messages understood by this
- * service.
- */
-static struct GNUNET_SERVER_MessageHandler handlers[] = {
-  {&GNUNET_FS_handle_index_start, NULL, 
-   GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0},
-  {&GNUNET_FS_handle_index_list_get, NULL, 
-   GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, sizeof(struct GNUNET_MessageHeader) },
-  {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX, 
-   sizeof (struct UnindexMessage) },
-  {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, 
-   0 },
-  {NULL, NULL, 0, 0}
-};
-
-
 /**
  * Process fs requests.
  *
@@ -3458,6 +3426,26 @@ main_init (struct GNUNET_SCHEDULER_Handle *s,
           struct GNUNET_SERVER_Handle *server,
           const struct GNUNET_CONFIGURATION_Handle *c)
 {
+  static const struct GNUNET_CORE_MessageHandler p2p_handlers[] =
+    {
+      { &handle_p2p_get, 
+       GNUNET_MESSAGE_TYPE_FS_GET, 0 },
+      { &handle_p2p_put, 
+       GNUNET_MESSAGE_TYPE_FS_PUT, 0 },
+      { NULL, 0, 0 }
+    };
+  static const struct GNUNET_SERVER_MessageHandler handlers[] = {
+    {&GNUNET_FS_handle_index_start, NULL, 
+     GNUNET_MESSAGE_TYPE_FS_INDEX_START, 0},
+    {&GNUNET_FS_handle_index_list_get, NULL, 
+     GNUNET_MESSAGE_TYPE_FS_INDEX_LIST_GET, sizeof(struct GNUNET_MessageHeader) },
+    {&GNUNET_FS_handle_unindex, NULL, GNUNET_MESSAGE_TYPE_FS_UNINDEX, 
+     sizeof (struct UnindexMessage) },
+    {&handle_start_search, NULL, GNUNET_MESSAGE_TYPE_FS_START_SEARCH, 
+     0 },
+    {NULL, NULL, 0, 0}
+  };
+
   sched = s;
   cfg = c;
   stats = GNUNET_STATISTICS_create (sched, "fs", cfg);
index 300a767b5992f5029a607990fa8ef1a422b30905..b0599312ceee890b33a312f5357f2fc9e6d11a5d 100644 (file)
@@ -53,12 +53,12 @@ static int provide_hostlist;
 /**
  * Handle to hostlist server's connect handler
  */
-static GNUNET_CORE_ConnectEventHandler server_ch = NULL;
+static GNUNET_CORE_ConnectEventHandler server_ch;
 
 /**
  * Handle to hostlist server's disconnect handler
  */
-static GNUNET_CORE_DisconnectEventHandler server_dh = NULL;
+static GNUNET_CORE_DisconnectEventHandler server_dh;
 
 #endif
 
index 5d8a07ef2cfe4a4e588cd836ddd13f697ba4ef82..0726bf3e04750f87a3e973d372f440fb490deb2e 100644 (file)
@@ -109,11 +109,6 @@ struct HostSet
  */
 static int advertising;
 
-/**
- * How many times was the hostlist advertised?
- */
-static uint64_t hostlist_adv_count;
-
 /**
  * Buffer for the hostlist address
  */
@@ -345,6 +340,8 @@ access_handler_callback (void *cls,
 static size_t
 adv_transmit_ready ( void *cls, size_t size, void *buf)
 {
+  static uint64_t hostlist_adv_count;
+
   size_t transmission_size;
   size_t uri_size; /* Including \0 termination! */
   struct GNUNET_MessageHeader header;
@@ -372,10 +369,10 @@ adv_transmit_ready ( void *cls, size_t size, void *buf)
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               " # Sent advertisement message: %u\n",
               hostlist_adv_count);
-  GNUNET_STATISTICS_set (stats,
-                         gettext_noop("# hostlist advertisements send"),
-                         hostlist_adv_count,
-                         GNUNET_NO);
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop("# hostlist advertisements send"),
+                           1,
+                           GNUNET_NO);
   return transmission_size;
 }
 
index efc6ce12890b440dc6dea51c53651c9bdc58c1a6..c34a00ddc2611f60f9082cbdec37d3be4debfdf3 100644 (file)
@@ -92,11 +92,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
  */
 static struct StatsEntry *start;
 
-/**
- * Counter used to generate unique values.
- */
-static uint32_t uidgen;
-
 /**
  * Load persistent values from disk.  Disk format is
  * exactly the same format that we also use for
@@ -316,6 +311,11 @@ handle_set (void *cls,
             struct GNUNET_SERVER_Client *client,
             const struct GNUNET_MessageHeader *message)
 {
+  /**
+   * Counter used to generate unique values.
+   */
+  static uint32_t uidgen;
+
   char *service;
   char *name;
   uint16_t msize;
index 56bbf65b52a9f1c4cef6544adc0495de80535ee3..8648a4679c3e417855c977dce402ef240b97af2d 100644 (file)
@@ -106,8 +106,6 @@ static int rawsock;
 
 static struct in_addr dummy;
  
-static struct in_addr target;
-
 static uint32_t port;
 
 static uint16_t 
@@ -364,6 +362,7 @@ int
 main (int argc, char *const *argv)
 {
   struct in_addr external;
+  struct in_addr target;
   uid_t uid;
 
   if (-1 == (rawsock = make_raw_socket()))
index 2d6a1cbb016180b62bc95bbe70fdfdd469d0950c..f3fc93a7abebe9b07dfbd0af32d29e717a0b5219 100644 (file)
@@ -804,12 +804,6 @@ struct CheckHelloValidatedContext
  */
 static struct GNUNET_HELLO_Message *our_hello;
 
-/**
- * "version" of "our_hello".  Used to see if a given neighbour has
- * already been sent the latest version of our HELLO message.
- */
-static unsigned int our_hello_version;
-
 /**
  * Our public key.
  */
@@ -845,11 +839,6 @@ static struct TransportClient *clients;
  */
 static struct TransportPlugin *plugins;
 
-/**
- * Our server.
- */
-static struct GNUNET_SERVER_Handle *server;
-
 /**
  * Handle to peerinfo service.
  */
@@ -1853,7 +1842,6 @@ refresh_hello ()
 
   GNUNET_free_non_null (our_hello);
   our_hello = hello;
-  our_hello_version++;
   GNUNET_PEERINFO_add_peer (peerinfo, our_hello);
   npos = neighbours;
   while (npos != NULL)
@@ -4885,13 +4873,13 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *
  * @param cls closure
  * @param s scheduler to use
- * @param serv the initialized server
+ * @param server the initialized server
  * @param c configuration to use
  */
 static void
 run (void *cls,
      struct GNUNET_SCHEDULER_Handle *s,
-     struct GNUNET_SERVER_Handle *serv,
+     struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   static const struct GNUNET_SERVER_MessageHandler handlers[] = {
@@ -4984,7 +4972,6 @@ run (void *cls,
   GNUNET_CRYPTO_hash (&my_public_key,
                       sizeof (my_public_key), &my_identity.hashPubKey);
   /* setup notification */
-  server = serv;
   GNUNET_SERVER_disconnect_notify (server,
                                    &client_disconnect_notification, NULL);
   /* load plugins... */