-fixing minor bugs, code cleanup
authorChristian Grothoff <christian@grothoff.org>
Fri, 1 Jun 2012 15:01:00 +0000 (15:01 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 1 Jun 2012 15:01:00 +0000 (15:01 +0000)
src/transport/plugin_transport_http.c
src/transport/plugin_transport_http_client.c
src/transport/plugin_transport_http_server.c
src/transport/test_transport_api_reliability.c

index d55cdb76b108f026672409c6e2ea5372379cf573..d99f531b7d1d65c5d39553b92e2795ee7dc620db 100644 (file)
@@ -268,13 +268,10 @@ http_plugin_address_pretty_printer (void *cls, const char *type,
 static int
 http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
 {
-
   struct Plugin *plugin = cls;
   struct IPv4HttpAddressWrapper *w_tv4 = plugin->ipv4_addr_head;
   struct IPv6HttpAddressWrapper *w_tv6 = plugin->ipv6_addr_head;
 
-
-
   GNUNET_assert (cls != NULL);
   if ((addrlen != sizeof (struct sockaddr_in)) ||
       (addrlen != sizeof (struct sockaddr_in6)))
@@ -358,11 +355,12 @@ http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
  * @param added length of created address
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
-int http_string_to_address (void *cls,
-                           const char *addr,
-                           uint16_t addrlen,
-                           void **buf,
-                           size_t *added)
+int 
+http_string_to_address (void *cls,
+                       const char *addr,
+                       uint16_t addrlen,
+                       void **buf,
+                       size_t *added)
 {
 #if !BUILD_HTTPS
   char *protocol = "http";
@@ -425,7 +423,7 @@ int http_string_to_address (void *cls,
     (*added) = sizeof (struct IPv4HttpAddress);
     return GNUNET_OK;
   }
-  else if (GNUNET_OK == GNUNET_STRINGS_to_address_ipv6(addr_str, strlen(addr_str), &addr_6))
+  if (GNUNET_OK == GNUNET_STRINGS_to_address_ipv6(addr_str, strlen(addr_str), &addr_6))
   {
     http_6addr = GNUNET_malloc (sizeof (struct IPv6HttpAddress));
     http_6addr->u6_port = addr_6.sin6_port;
@@ -434,18 +432,14 @@ int http_string_to_address (void *cls,
     (*added) = sizeof (struct IPv6HttpAddress);
     return GNUNET_OK;
   }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                     "Invalid address string `%s' to convert to address\n",
-                     addr_str);
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+             "Invalid address string `%s' to convert to address\n",
+             addr_str);
+  GNUNET_break (0);
+  return GNUNET_SYSERR;  
 }
 
 
-
 /**
  * Function called for a quick conversion of the binary address to
  * a numeric address.  Note that the caller must not free the
@@ -513,6 +507,7 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
   return rbuf;
 }
 
+
 struct Session *
 lookup_session_old (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
                 struct Session *session, const void *addr, size_t addrlen,
@@ -526,11 +521,11 @@ lookup_session_old (struct Plugin *plugin, const struct GNUNET_PeerIdentity *tar
   {
 #if 0
     GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
-                     "Comparing peer `%s' address `%s' len %i session %X to \n",
+                     "Comparing peer `%s' address `%s' len %i session %p to \n",
                      GNUNET_i2s (target), GNUNET_a2s (addr, addrlen), addrlen,
                      session);
     GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
-                     "peer `%s' address `%s' len %i session %X \n\n",
+                     "peer `%s' address `%s' len %i session %p \n\n",
                      GNUNET_i2s (&t->target), GNUNET_a2s (t->addr, t->addrlen),
                      t->addrlen, t);
     GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, "memcmp %i \n",
@@ -558,6 +553,7 @@ lookup_session_old (struct Plugin *plugin, const struct GNUNET_PeerIdentity *tar
   return NULL;
 }
 
+
 struct Session *
 lookup_session (struct Plugin *plugin,
                 const struct GNUNET_HELLO_Address *address)
@@ -572,6 +568,7 @@ lookup_session (struct Plugin *plugin,
   return NULL;
 }
 
+
 int
 exist_session (struct Plugin *plugin, struct Session *s)
 {
@@ -589,7 +586,6 @@ exist_session (struct Plugin *plugin, struct Session *s)
 }
 
 
-
 void
 delete_session (struct Session *s)
 {
@@ -606,6 +602,7 @@ delete_session (struct Session *s)
   GNUNET_free (s);
 }
 
+
 struct Session *
 create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
                 const void *addr, size_t addrlen)
@@ -626,7 +623,6 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
 }
 
 
-
 void
 notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
                     struct Session *s)
@@ -638,6 +634,7 @@ notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
   delete_session (s);
 }
 
+
 /**
  * Creates a new outbound session the transport service will use to send data to the
  * peer
@@ -646,7 +643,6 @@ notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
  * @param address the address
  * @return the session or NULL of max connections exceeded
  */
-
 static struct Session *
 http_get_session (void *cls,
                   const struct GNUNET_HELLO_Address *address)
@@ -730,6 +726,7 @@ http_get_session (void *cls,
   return s;
 }
 
+
 /**
  * Function that can be used by the transport service to transmit
  * a message using the plugin.   Note that in the case of a
@@ -791,7 +788,6 @@ http_plugin_send (void *cls,
   }
 
   /* create new message and schedule */
-
   msg = GNUNET_malloc (sizeof (struct HTTP_Message) + msgbuf_size);
   msg->next = NULL;
   msg->size = msgbuf_size;
@@ -875,6 +871,7 @@ http_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
   }
 }
 
+
 static void *
 find_address (struct Plugin *plugin, const struct sockaddr *addr, socklen_t addrlen)
 {
@@ -933,6 +930,7 @@ find_address (struct Plugin *plugin, const struct sockaddr *addr, socklen_t addr
   return NULL;
 }
 
+
 static void
 nat_add_address (void *cls, int add_remove, const struct sockaddr *addr,
                  socklen_t addrlen)
@@ -993,6 +991,7 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr,
 
 }
 
+
 static void
 nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr,
                     socklen_t addrlen)
@@ -1044,9 +1043,9 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr,
   default:
     return;
   }
-
 }
 
+
 /**
  * Our external IP address/port mapping has changed.
  *
@@ -1079,6 +1078,7 @@ nat_port_map_callback (void *cls, int add_remove, const struct sockaddr *addr,
   }
 }
 
+
 void
 http_check_ipv6 (struct Plugin *plugin)
 {
@@ -1112,6 +1112,7 @@ http_check_ipv6 (struct Plugin *plugin)
   }
 }
 
+
 int
 http_get_addresses (struct Plugin *plugin, const char *serviceName,
                     const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1322,6 +1323,7 @@ start_report_addresses (struct Plugin *plugin)
   }
 }
 
+
 static void
 stop_report_addresses (struct Plugin *plugin)
 {
@@ -1349,6 +1351,7 @@ stop_report_addresses (struct Plugin *plugin)
   }
 }
 
+
 static int
 configure_plugin (struct Plugin *plugin)
 {
@@ -1504,6 +1507,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
 }
 
+
 /**
  * Start session timeout
  */
@@ -1521,6 +1525,7 @@ start_session_timeout (struct Session *s)
       s, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
 }
 
+
 /**
  * Increment session timeout due to activity
  */
@@ -1539,6 +1544,7 @@ reschedule_session_timeout (struct Session *s)
       s, GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
 }
 
+
 /**
  * Cancel timeout
  */
index 79f70bb6c61d63396d9f2186ce250fe0a420416d..179c9580ea0e88a3cab6596b0ab2058669d6eb13 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
+     (C) 2002--2012 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
@@ -55,10 +55,10 @@ client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls)
     }
 #if BUILD_HTTPS
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https",
-                     "Client: %X - %s", cls, text);
+                     "Client: %p - %s", cls, text);
 #else
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http",
-                     "Client: %X - %s", cls, text);
+                     "Client: %p - %s", cls, text);
 #endif
   }
   return 0;
@@ -73,6 +73,7 @@ client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls)
 static void
 client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
+
 /**
  * Function setting up file descriptors and scheduling task to run
  *
@@ -99,7 +100,6 @@ client_schedule (struct Plugin *plugin, int now)
     GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
     plugin->client_perform_task = GNUNET_SCHEDULER_NO_TASK;
   }
-
   max = -1;
   FD_ZERO (&rs);
   FD_ZERO (&ws);
@@ -154,24 +154,22 @@ client_send (struct Session *s, struct HTTP_Message *msg)
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
-
   if (s->client_put_paused == GNUNET_YES)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
-                     "Client: %X was suspended, unpausing\n", s->client_put);
+                     "Client: %p was suspended, unpausing\n", s->client_put);
     s->client_put_paused = GNUNET_NO;
     curl_easy_pause (s->client_put, CURLPAUSE_CONT);
   }
-
   client_schedule (s->plugin, GNUNET_YES);
 
   return GNUNET_OK;
 }
 
 
-
 /**
  * Task performing curl operations
+ *
  * @param cls plugin as closure
  * @param tc gnunet scheduler task context
  */
@@ -228,7 +226,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       if (msg->msg == CURLMSG_DONE)
       {
         GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                         "Client: %X connection to '%s'  %s ended with reason %i: `%s'\n",
+                         "Client: %p connection to '%s'  %s ended with reason %i: `%s'\n",
                          msg->easy_handle, GNUNET_i2s (&s->target),
                          http_plugin_address_to_string (NULL, s->addr,
                                                         s->addrlen),
@@ -236,7 +234,11 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                          curl_easy_strerror (msg->data.result));
 
         client_disconnect (s);
-        //GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen));
+        GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 
+                        plugin->name,
+                        "Notifying about ended session to peer `%s' `%s'\n", 
+                        GNUNET_i2s (&s->target), 
+                        http_plugin_address_to_string (plugin, s->addr, s->addrlen));
         notify_session_end (plugin, &s->target, s);
       }
     }
@@ -245,6 +247,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   client_schedule (plugin, GNUNET_NO);
 }
 
+
 int
 client_disconnect (struct Session *s)
 {
@@ -263,7 +266,7 @@ client_disconnect (struct Session *s)
   if (s->client_put != NULL)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Client: %X Deleting outbound PUT session to peer `%s'\n",
+                     "Client: %p Deleting outbound PUT session to peer `%s'\n",
                      s->client_put, GNUNET_i2s (&s->target));
 
     mret = curl_multi_remove_handle (plugin->client_mh, s->client_put);
@@ -287,7 +290,7 @@ client_disconnect (struct Session *s)
   if (s->client_get != NULL)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Client: %X Deleting outbound GET session to peer `%s'\n",
+                     "Client: %p Deleting outbound GET session to peer `%s'\n",
                      s->client_get, GNUNET_i2s (&s->target));
 
     mret = curl_multi_remove_handle (plugin->client_mh, s->client_get);
@@ -362,6 +365,7 @@ client_receive_mst_cb (void *cls, void *client,
   return GNUNET_OK;
 }
 
+
 static void
 client_wake_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -372,29 +376,26 @@ client_wake_up (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     GNUNET_break (0);
     return;
   }
-
   s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK;
-
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
     return;
-
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
-                   "Client: %X Waking up receive handle\n", s->client_get);
-
+                   "Client: %p Waking up receive handle\n", s->client_get);
   if (s->client_get != NULL)
     curl_easy_pause (s->client_get, CURLPAUSE_CONT);
-
 }
 
+
 /**
-* Callback method used with libcurl
-* Method is called when libcurl needs to write data during sending
-* @param stream pointer where to write data
-* @param size size of an individual element
-* @param nmemb count of elements that can be written to the buffer
-* @param cls destination pointer, passed to the libcurl handle
-* @return bytes read from stream
-*/
+ * Callback method used with libcurl
+ * Method is called when libcurl needs to write data during sending
+ *
+ * @param stream pointer where to write data
+ * @param size size of an individual element
+ * @param nmemb count of elements that can be written to the buffer
+ * @param cls destination pointer, passed to the libcurl handle
+ * @return bytes read from stream
+ */
 static size_t
 client_receive (void *stream, size_t size, size_t nmemb, void *cls)
 {
@@ -413,7 +414,7 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls)
     struct GNUNET_TIME_Relative delta =
         GNUNET_TIME_absolute_get_difference (now, s->next_receive);
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Client: %X No inbound bandwidth available! Next read was delayed for %llu ms\n",
+                     "Client: %p No inbound bandwidth available! Next read was delayed for %llu ms\n",
                      s->client_get, delta.rel_value);
     if (s->recv_wakeup_task != GNUNET_SCHEDULER_NO_TASK)
     {
@@ -424,19 +425,17 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls)
         GNUNET_SCHEDULER_add_delayed (delta, &client_wake_up, s);
     return CURLPAUSE_ALL;
   }
-
-
-  if (s->msg_tk == NULL)
+  if (NULL == s->msg_tk)
     s->msg_tk = GNUNET_SERVER_mst_create (&client_receive_mst_cb, s);
-
   GNUNET_SERVER_mst_receive (s->msg_tk, s, stream, len, GNUNET_NO, GNUNET_NO);
-
   return len;
 }
 
+
 /**
  * Callback method used with libcurl
  * Method is called when libcurl needs to read data during sending
+ *
  * @param stream pointer where to write data
  * @param size size of an individual element
  * @param nmemb count of elements that can be written to the buffer
@@ -448,67 +447,46 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
 {
   struct Session *s = cls;
   struct Plugin *plugin = s->plugin;
+  struct HTTP_Message *msg = s->msg_head;
   size_t bytes_sent = 0;
   size_t len;
 
   if (GNUNET_YES != exist_session(plugin, s))
   {
     GNUNET_break (0);
-    return GNUNET_SYSERR;
+    return 0;
   }
-
-  struct HTTP_Message *msg = s->msg_head;
-
-  if (msg == NULL)
+  if (NULL == msg)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Client: %X Nothing to send! Suspending PUT handle!\n",
+                     "Client: %p Nothing to send! Suspending PUT handle!\n",
                      s->client_put);
     s->client_put_paused = GNUNET_YES;
     return CURL_READFUNC_PAUSE;
   }
-
-  GNUNET_assert (msg != NULL);
   /* data to send */
-  if (msg->pos < msg->size)
-  {
-    /* data fit in buffer */
-    if ((msg->size - msg->pos) <= (size * nmemb))
-    {
-      len = (msg->size - msg->pos);
-      memcpy (stream, &msg->buf[msg->pos], len);
-      msg->pos += len;
-      bytes_sent = len;
-    }
-    else
-    {
-      len = size * nmemb;
-      memcpy (stream, &msg->buf[msg->pos], len);
-      msg->pos += len;
-      bytes_sent = len;
-    }
-  }
-  /* no data to send */
-  else
-  {
-    GNUNET_assert (0);
-    bytes_sent = 0;
-  }
-
+  GNUNET_assert (msg->pos < msg->size);
+  /* calculate how much fits in buffer */
+  bytes_sent = GNUNET_MIN (msg->size - msg->pos,
+                          size * nmemb);
+  memcpy (stream, &msg->buf[msg->pos], len);
+  msg->pos += len;
+  bytes_sent = len;
   if (msg->pos == msg->size)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Client: %X Message with %u bytes sent, removing message from queue\n",
+                     "Client: %p Message with %u bytes sent, removing message from queue\n",
                      s->client_put, msg->size, msg->pos);
     /* Calling transmit continuation  */
+    GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
     if (NULL != msg->transmit_cont)
       msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK);
-    GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
     GNUNET_free (msg);
   }
   return bytes_sent;
 }
 
+
 int
 client_connect (struct Session *s)
 {
@@ -631,6 +609,7 @@ client_connect (struct Session *s)
   return res;
 }
 
+
 int
 client_start (struct Plugin *plugin)
 {
@@ -651,6 +630,7 @@ client_start (struct Plugin *plugin)
   return res;
 }
 
+
 void
 client_stop (struct Plugin *plugin)
 {
index d57ce88b92a47d324f25649c0ec07b1c5b9868cb..4a6e8c18f942c6bcec9745bbe9a607781f17b59f 100644 (file)
@@ -163,10 +163,8 @@ server_load_certificate (struct Plugin *plugin)
     GNUNET_free_non_null (plugin->cert);
     plugin->cert = NULL;
 
-#if VERBOSE_SERVER
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "No usable TLS certificate found, creating certificate\n");
-#endif
     errno = 0;
     cert_creation =
         GNUNET_OS_start_process (GNUNET_NO, NULL, NULL,
@@ -230,7 +228,6 @@ server_load_certificate (struct Plugin *plugin)
  * @param now GNUNET_YES to schedule execution immediately, GNUNET_NO to wait
  * until timeout
  */
-
 static void
 server_reschedule (struct Plugin *plugin, struct MHD_Daemon *server, int now)
 {
@@ -302,6 +299,7 @@ server_receive_mst_cb (void *cls, void *client,
   return GNUNET_OK;
 }
 
+
 /**
  * Callback called by MHD when it needs data to send
  * @param cls current session
@@ -314,44 +312,32 @@ static ssize_t
 server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
 {
   struct Session *s = cls;
+  ssize_t bytes_read = 0;
+  struct HTTP_Message *msg;
+
   GNUNET_assert (NULL != p);
   if (GNUNET_NO == exist_session(p, s))
     return 0;
-
-  struct HTTP_Message *msg;
-  int bytes_read = 0;
-
-  //static int c = 0;
   msg = s->msg_head;
-  if (msg != NULL)
+  if (NULL != msg)
   {
     /* sending */
-    if ((msg->size - msg->pos) <= max)
-    {
-      memcpy (buf, &msg->buf[msg->pos], (msg->size - msg->pos));
-      bytes_read = msg->size - msg->pos;
-      msg->pos += (msg->size - msg->pos);
-    }
-    else
-    {
-      memcpy (buf, &msg->buf[msg->pos], max);
-      msg->pos += max;
-      bytes_read = max;
-    }
+    bytes_read = GNUNET_MIN (msg->size - msg->pos,
+                            max);
+    memcpy (buf, &msg->buf[msg->pos], bytes_read);
+    msg->pos += bytes_read;
 
     /* removing message */
     if (msg->pos == msg->size)
     {
+      GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
       if (NULL != msg->transmit_cont)
         msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK);
-      GNUNET_CONTAINER_DLL_remove (s->msg_head, s->msg_tail, msg);
       GNUNET_free (msg);
     }
   }
-
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
-                   "Server: %X: sent %u bytes\n", s, bytes_read);
-
+                   "Server: %p: sent %u bytes\n", s, bytes_read);
   return bytes_read;
 }
 
@@ -585,7 +571,7 @@ found:
   int to = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000);
 
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                   "Server: Setting timeout for %X to %u sec.\n", sc, to);
+                   "Server: Setting timeout for %p to %u sec.\n", sc, to);
   MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to);
 
   struct MHD_Daemon *d = NULL;
@@ -707,7 +693,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
       if ((s->next_receive.abs_value <= now.abs_value))
       {
         GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                         "Server: %X: PUT with %u bytes forwarded to MST\n", s,
+                         "Server: %p: PUT with %u bytes forwarded to MST\n", s,
                          *upload_data_size);
         if (s->msg_tk == NULL)
         {
@@ -727,7 +713,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
         {
           t = s->server_recv;
           GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                           "Server: Setting timeout for %X to %u sec.\n", t,
+                           "Server: Setting timeout for %p to %u sec.\n", t,
                            to);
           MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT,
                                      to);
@@ -736,7 +722,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
         {
           t = s->server_send;
           GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                           "Server: Setting timeout for %X to %u sec.\n", t,
+                           "Server: Setting timeout for %p to %u sec.\n", t,
                            to);
           MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT,
                                      to);
@@ -754,7 +740,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
       else
       {
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Server: %X no inbound bandwidth available! Next read was delayed by %llu ms\n",
+                    "Server: %p no inbound bandwidth available! Next read was delayed by %llu ms\n",
                     s, now.abs_value - s->next_receive.abs_value);
       }
       return MHD_YES;
@@ -790,7 +776,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
   {
 
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Server: %X peer `%s' GET on address `%s' disconnected\n",
+                     "Server: %p peer `%s' GET on address `%s' disconnected\n",
                      s->server_send, GNUNET_i2s (&s->target),
                      http_plugin_address_to_string (NULL, s->addr, s->addrlen));
     s->server_send = NULL;
@@ -807,7 +793,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
   if (sc->direction == _RECEIVE)
   {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Server: %X peer `%s' PUT on address `%s' disconnected\n",
+                     "Server: %p peer `%s' PUT on address `%s' disconnected\n",
                      s->server_recv, GNUNET_i2s (&s->target),
                      http_plugin_address_to_string (NULL, s->addr, s->addrlen));
     s->server_recv = NULL;
index f719a42afaa1e682a98e71d1278cd1819382a988..759241c522fd41ecfd9eea9931d3a7c9607e96f0 100644 (file)
@@ -243,7 +243,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (0 != memcmp (cbuf, &hdr[1], s - sizeof (struct TestMessage)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Expected message %u with bits %u, but body did not match\n", n,
+                "Expected message %u with bits %u, but body did not match at position %u\n", n,
                 (unsigned char) n);
     if (die_task != GNUNET_SCHEDULER_NO_TASK)
       GNUNET_SCHEDULER_cancel (die_task);