commented out wrong message type
[oweals/gnunet.git] / src / statistics / statistics_api.c
index 856873d004207e02b85f25cb637932196eb57c05..9d04e854faeac3fc696066b3718df8219b851d49 100644 (file)
@@ -349,7 +349,7 @@ schedule_watch_request (struct GNUNET_STATISTICS_Handle *h,
   slen = strlen (watch->subsystem) + 1;
   nlen = strlen (watch->name) + 1;
   nsize = sizeof (struct GNUNET_MessageHeader) + slen + nlen;
-  if (nsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+  if (nsize >= GNUNET_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
     return;
@@ -576,16 +576,16 @@ do_destroy (void *cls)
 
 
 /**
- * Handle a #GNUNET_MESSAGE_TYPE_TEST (sic) message. We receive this
- * message at the end of the shutdown when the service confirms that
- * all data has been written to disk.
+ * Handle a #GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT_CONFIRM
+ * message. We receive this message at the end of the shutdown when
+ * the service confirms that all data has been written to disk.
  *
  * @param cls our `struct GNUNET_STATISTICS_Handle *`
  * @param msg the message
  */
 static void
-handle_test (void *cls,
-             const struct GNUNET_MessageHeader *msg)
+handle_disconnect_confirm (void *cls,
+                          const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_STATISTICS_Handle *h = cls;
 
@@ -598,7 +598,7 @@ handle_test (void *cls,
     return;
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received TEST message from statistics, can complete disconnect\n");
+       "Received DISCONNNECT_CONFIRM message from statistics, can complete disconnect\n");
   if (NULL != h->destroy_task)
     GNUNET_SCHEDULER_cancel (h->destroy_task);
   h->destroy_task = GNUNET_SCHEDULER_add_now (&do_destroy,
@@ -653,8 +653,8 @@ static int
 try_connect (struct GNUNET_STATISTICS_Handle *h)
 {
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_fixed_size (test,
-                             GNUNET_MESSAGE_TYPE_TEST,
+    GNUNET_MQ_hd_fixed_size (disconnect_confirm,
+                             GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT_CONFIRM,
                              struct GNUNET_MessageHeader,
                              h),
     GNUNET_MQ_hd_fixed_size (statistics_end,
@@ -678,7 +678,7 @@ try_connect (struct GNUNET_STATISTICS_Handle *h)
     return GNUNET_NO;
   if (NULL != h->mq)
     return GNUNET_YES;
-  h->mq = GNUNET_CLIENT_connecT (h->cfg,
+  h->mq = GNUNET_CLIENT_connect (h->cfg,
                                  "statistics",
                                  handlers,
                                  &mq_error_handler,
@@ -1015,7 +1015,7 @@ schedule_action (void *cls)
     return;
   }
   if (0 < GNUNET_MQ_get_length (h->mq))
-    return; /* Wait for queue to be reduced more */
+    return; /* Wait for queue to be reduced more */    
   /* schedule next action */
   while (NULL == h->current)
   {
@@ -1032,7 +1032,7 @@ schedule_action (void *cls)
                   "Notifying service that we are done\n");
       h->do_destroy = GNUNET_SYSERR; /* in 'TEST' mode */
       env = GNUNET_MQ_msg (hdr,
-                           GNUNET_MESSAGE_TYPE_TEST);
+                           GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT);
       GNUNET_MQ_notify_sent (env,
                              &schedule_action,
                              h);
@@ -1098,7 +1098,7 @@ GNUNET_STATISTICS_get (struct GNUNET_STATISTICS_Handle *handle,
   slen1 = strlen (subsystem) + 1;
   slen2 = strlen (name) + 1;
   GNUNET_assert (slen1 + slen2 + sizeof (struct GNUNET_MessageHeader) <
-                 GNUNET_SERVER_MAX_MESSAGE_SIZE);
+                 GNUNET_MAX_MESSAGE_SIZE);
   ai = GNUNET_new (struct GNUNET_STATISTICS_GetHandle);
   ai->sh = handle;
   ai->subsystem = GNUNET_strdup (subsystem);
@@ -1246,15 +1246,17 @@ add_setter_action (struct GNUNET_STATISTICS_Handle *h,
   slen = strlen (h->subsystem) + 1;
   nlen = strlen (name) + 1;
   nsize = sizeof (struct GNUNET_STATISTICS_SetMessage) + slen + nlen;
-  if (nsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+  if (nsize >= GNUNET_MAX_MESSAGE_SIZE)
   {
     GNUNET_break (0);
     return;
   }
   for (ai = h->action_head; NULL != ai; ai = ai->next)
   {
-    if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) &&
-           (0 == strcmp (ai->name, name)) &&
+    if (! ( (0 == strcmp (ai->subsystem,
+                         h->subsystem)) &&
+           (0 == strcmp (ai->name,
+                         name)) &&
            ( (ACTION_UPDATE == ai->type) ||
              (ACTION_SET == ai->type) ) ) )
       continue;