Removing all the tests for the bluetooth transport plugin.
[oweals/gnunet.git] / src / transport / plugin_transport_tcp.c
index 9d710e5237ac548f631e2cae7b9312045e6a867d..37a4aa7cdf1e245b8dc69269bfabc70781f6e6d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2002--2012 Christian Grothoff (and other contributing authors)
+     (C) 2002--2013 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
@@ -597,7 +597,6 @@ tcp_address_to_string (void *cls, const void *addr, size_t addrlen)
   uint16_t port;
   uint32_t options;
 
-  options = 0;
   switch (addrlen)
   {
   case sizeof (struct IPv6TcpAddress):
@@ -665,7 +664,6 @@ tcp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
   address = NULL;
   plugin = NULL;
   optionstr = NULL;
-  options = 0;
   if ((NULL == addr) || (addrlen == 0))
   {
     GNUNET_break (0);
@@ -897,7 +895,7 @@ do_transmit (void *cls, size_t size, void *buf)
     ret = 0;
     now = GNUNET_TIME_absolute_get ();
     while ((NULL != (pos = session->pending_messages_head)) &&
-           (pos->timeout.abs_value <= now.abs_value))
+           (pos->timeout.abs_value_us <= now.abs_value_us))
     {
       GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
                                    session->pending_messages_tail, pos);
@@ -1639,7 +1637,7 @@ ppc_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                        count++;
        }
 
-       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cancel request %p, %u pending\n", ppc, count);
+       // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cancel request %p, %u pending\n", ppc, count);
        ppc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
        if (NULL != ppc->resolver_handle)
        {
@@ -1671,7 +1669,7 @@ append_port (void *cls, const char *hostname)
                if (cur != ppc)
                        count++;
        }
-       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Callback request %p == %s, %u pending\n", ppc, hostname, count);
+       //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Callback request %p == %s, %u pending\n", ppc, hostname, count);
   if (hostname == NULL)
   {
     ppc->asc (ppc->asc_cls, NULL);
@@ -1679,7 +1677,7 @@ append_port (void *cls, const char *hostname)
     GNUNET_SCHEDULER_cancel (ppc->timeout_task);
     ppc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
     ppc->resolver_handle = NULL;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Done request %p, %u pending\n", ppc, count);
+    //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Done request %p, %u pending\n", ppc, count);
     GNUNET_free (ppc);
     return;
   }
@@ -1735,8 +1733,6 @@ tcp_plugin_address_pretty_printer (void *cls, const char *type,
   uint16_t port;
   uint32_t options;
 
-
-  options = 0;
   if (addrlen == sizeof (struct IPv6TcpAddress))
   {
     t6 = addr;
@@ -1789,7 +1785,7 @@ tcp_plugin_address_pretty_printer (void *cls, const char *type,
                        timeout, &append_port, ppc);
        if (NULL != ppc->resolver_handle)
        {
-               GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding request %p\n", ppc);
+               //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding request %p\n", ppc);
                GNUNET_CONTAINER_DLL_insert (ppc_dll_head, ppc_dll_tail, ppc);
        }
        else
@@ -2269,16 +2265,16 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client,
 
   reschedule_session_timeout (session);
 
-  if (delay.rel_value == 0)
+  if (0 == delay.rel_value_us)
   {
     GNUNET_SERVER_receive_done (client, GNUNET_OK);
   }
   else
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, 
-        "Throttling receiving from `%s' for %llu ms\n",
+        "Throttling receiving from `%s' for %s\n",
         GNUNET_i2s (&session->target),
-        (unsigned long long) delay.rel_value);
+        GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
     GNUNET_SERVER_disable_receive_done_warning (client);
     session->receive_delay_task =
         GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
@@ -2426,8 +2422,10 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Session %p was idle for %llu ms, disconnecting\n",
-             s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
+             "Session %p was idle for %s, disconnecting\n",
+             s,
+             GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+                                                     GNUNET_YES));
   /* call session destroy function */
   disconnect_session(s);
 }
@@ -2445,8 +2443,10 @@ start_session_timeout (struct Session *s)
                                                    &session_timeout,
                                                    s);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Timeout for session %p set to %llu ms\n",
-             s,  (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
+             "Timeout for session %p set to %s\n",
+             s,  
+             GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+                                                     GNUNET_YES));
 }
 
 
@@ -2464,8 +2464,10 @@ reschedule_session_timeout (struct Session *s)
                                                    &session_timeout,
                                                    s);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Timeout rescheduled for session %p set to %llu ms\n",
-             s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
+              "Timeout rescheduled for session %p set to %s\n",
+             s, 
+             GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+                                                     GNUNET_YES));
 }
 
 
@@ -2483,7 +2485,7 @@ stop_session_timeout (struct Session *s)
     s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Timeout stopped for session %p canceled\n",
-                s, (unsigned long long) GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value);
+                s);
   }
 }