- fix
[oweals/gnunet.git] / src / nse / nse_api.c
index 8ff0256b9107e880b4d2ab21bad2bcbf3b69ff9a..4d5f6bb714232a7b5a5ed1fa298746b8114fa5e7 100644 (file)
@@ -35,6 +35,7 @@
 #include "gnunet_nse_service.h"
 #include "nse.h"
 
+#define LOG(kind,...) GNUNET_log_from (kind, "nse-api",__VA_ARGS__)
 
 /**
  * Handle for the service.
@@ -85,8 +86,8 @@ struct GNUNET_NSE_Handle
  * @param cls the handle to the transport service
  * @param tc scheduler context
  */
-static void reconnect (void *cls,
-                       const struct GNUNET_SCHEDULER_TaskContext *tc);
+static void
+reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
 /**
@@ -119,7 +120,8 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
   }
   client_msg = (const struct GNUNET_NSE_ClientMessage *) msg;
   h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp),
-              client_msg->size_estimate, client_msg->std_deviation);
+              GNUNET_ntoh_double (client_msg->size_estimate), 
+             GNUNET_ntoh_double (client_msg->std_deviation));
   GNUNET_CLIENT_receive (h->client, &message_handler, h,
                          GNUNET_TIME_UNIT_FOREVER_REL);
 }
@@ -148,9 +150,9 @@ reschedule_connect (struct GNUNET_NSE_Handle *h)
   }
 
 #if DEBUG_NSE
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Scheduling task to reconnect to nse service in %llu ms.\n",
-              h->reconnect_delay.rel_value);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Scheduling task to reconnect to nse service in %llu ms.\n",
+       h->reconnect_delay.rel_value);
 #endif
   h->reconnect_task =
       GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
@@ -186,14 +188,14 @@ send_start (void *cls, size_t size, void *buf)
   {
     /* Connect error... */
 #if DEBUG_NSE
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Shutdown while trying to transmit `%s' request.\n", "START");
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Shutdown while trying to transmit `%s' request.\n", "START");
 #endif
     reschedule_connect (h);
     return 0;
   }
 #if DEBUG_NSE
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START");
 #endif
   GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
 
@@ -224,8 +226,8 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     return;
   }
 #if DEBUG_NSE
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Connecting to network size estimation service.\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Connecting to network size estimation service.\n");
 #endif
   GNUNET_assert (h->client == NULL);
   h->client = GNUNET_CLIENT_connect ("nse", h->cfg);