gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r31292 - in gnunet/src: dv include transport


From: gnunet
Subject: [GNUnet-SVN] r31292 - in gnunet/src: dv include transport
Date: Wed, 11 Dec 2013 23:50:10 +0100

Author: grothoff
Date: 2013-12-11 23:50:10 +0100 (Wed, 11 Dec 2013)
New Revision: 31292

Modified:
   gnunet/src/dv/test_transport_dv_data.conf
   gnunet/src/include/gnunet_transport_plugin.h
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
-more logging, etc.

Modified: gnunet/src/dv/test_transport_dv_data.conf
===================================================================
--- gnunet/src/dv/test_transport_dv_data.conf   2013-12-11 21:25:23 UTC (rev 
31291)
+++ gnunet/src/dv/test_transport_dv_data.conf   2013-12-11 22:50:10 UTC (rev 
31292)
@@ -3,12 +3,16 @@
 [transport]
 PORT = 2565
 PLUGINS = tcp dv
-PREFIX = valgrind
+PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high
 
 [dv]
 AUTOSTART = YES
-#PREFIX = valgrind
+PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high
 
 [set]
 AUTOSTART = YES
-#PREFIX = valgrind
+PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high
+
+[core]
+PREFIX = valgrind --leak-check=full --track-fds=yes --leak-resolution=high
+

Modified: gnunet/src/include/gnunet_transport_plugin.h
===================================================================
--- gnunet/src/include/gnunet_transport_plugin.h        2013-12-11 21:25:23 UTC 
(rev 31291)
+++ gnunet/src/include/gnunet_transport_plugin.h        2013-12-11 22:50:10 UTC 
(rev 31292)
@@ -90,7 +90,7 @@
  * @param peer peer
  * @param plugin plugin
  * @param address address
- * @param address_len length of the address
+ * @param address_len length of the @a address
  * @param session session
  * @param ats ATS information
  * @param ats_count number of ATS information contained
@@ -122,7 +122,7 @@
  *                for inbound TCP/UDP connections since it it not clear
  *                that we could establish ourselves a connection to that
  *                IP address and get the same system)
- * @param sender_address_len number of bytes in sender_address
+ * @param sender_address_len number of bytes in @a sender_address
  * @return how long the plugin should wait until receiving more data
  *         (plugins that do not support this, can ignore the return value)
  */
@@ -141,7 +141,7 @@
  *
  * @param cls closure
  * @param addr binary address
- * @param addrlen length of the address
+ * @param addrlen length of the @a addr
  * @return ATS Information containing the network type
  */
 typedef struct GNUNET_ATS_Information
@@ -156,10 +156,10 @@
  * @param cls closure
  * @param peer peer
  * @param address address
- * @param address_len length of the address
+ * @param address_len length of the @a address
  * @param session session
  * @param ats ATS information
- * @param ats_count number of ATS information contained
+ * @param ats_count number of ATS information contained in @a ats
  */
 typedef void
 (*GNUNET_TRANSPORT_UpdateAddressMetrics) (void *cls,
@@ -183,7 +183,7 @@
  * @param dest_plugin plugin to use this address with
  */
 typedef void (*GNUNET_TRANSPORT_AddressNotification) (void *cls,
-                                                                               
                                                                                
                                                        int add_remove,
+                                                      int add_remove,
                                                       const void *addr,
                                                       size_t addrlen,
                                                       const char *dest_plugin);
@@ -312,19 +312,19 @@
  *
  * @param cls closure
  * @param target who was the recipient of the message?
- * @param result GNUNET_OK on success
- *               GNUNET_SYSERR if the target disconnected;
+ * @param result #GNUNET_OK on success
+ *               #GNUNET_SYSERR if the target disconnected;
  *               disconnect will ALSO be signalled using
  *               the ReceiveCallback.
  * @param size_payload bytes of payload from transport service in message
  * @param size_on_wire bytes required on wire for transmission,
- *               0 if result == GNUNET_SYSERR
+ *               0 if result == #GNUNET_SYSERR
  */
 typedef void (*GNUNET_TRANSPORT_TransmitContinuation) (void *cls,
-                                                                const struct 
GNUNET_PeerIdentity *target,
-                                                                int result,
-                                                                size_t 
size_payload,
-                                                                size_t 
size_on_wire);
+                                                       const struct 
GNUNET_PeerIdentity *target,
+                                                       int result,
+                                                       size_t size_payload,
+                                                       size_t size_on_wire);
 
 /**
  * The new send function with just the session and no address
@@ -339,7 +339,7 @@
  * @param cls closure
  * @param session which session must be used
  * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in 'msgbuf'
+ * @param msgbuf_size number of bytes in @a msgbuf
  * @param priority how important is the message (most plugins will
  *                 ignore message priority and just FIFO)
  * @param to how long to wait at most for the transmission (does not
@@ -409,16 +409,16 @@
  * @param numeric should (IP) addresses be displayed in numeric form?
  * @param timeout after how long should we give up?
  * @param asc function to call on each string
- * @param asc_cls closure for asc
+ * @param asc_cls closure for @a asc
  */
 typedef void (*GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls,
-                                                                               
                                                 const char *type,
-                                                                               
                                                 const void *addr,
-                                                                               
                                                 size_t addrlen,
-                                                                               
                                                 int numeric,
-                                                                               
                                                 struct GNUNET_TIME_Relative 
timeout,
-                                                                               
                                                 
GNUNET_TRANSPORT_AddressStringCallback asc,
-                                                                               
                                                 void *asc_cls);
+                                                       const char *type,
+                                                       const void *addr,
+                                                       size_t addrlen,
+                                                       int numeric,
+                                                       struct 
GNUNET_TIME_Relative timeout,
+                                                       
GNUNET_TRANSPORT_AddressStringCallback asc,
+                                                       void *asc_cls);
 
 
 /**
@@ -431,12 +431,12 @@
  * and not some potential man-in-the-middle).
  *
  * @param addr pointer to the address
- * @param addrlen length of addr
- * @return GNUNET_OK if this is a plausible address for this peer
- *         and transport, GNUNET_SYSERR if not
+ * @param addrlen length of @a addr
+ * @return #GNUNET_OK if this is a plausible address for this peer
+ *         and transport, #GNUNET_SYSERR if not
  */
 typedef int (*GNUNET_TRANSPORT_CheckAddress) (void *cls,
-                                                                               
                                                                                
                        const void *addr,
+                                              const void *addr,
                                               size_t addrlen);
 
 /**
@@ -473,11 +473,11 @@
  *
  * @param cls closure ('struct Plugin*')
  * @param addr string address
- * @param addrlen length of the address including \0 termination
+ * @param addrlen length of the address including '\0' termination
  * @param buf location to store the buffer
- *        If the function returns GNUNET_SYSERR, its contents are undefined.
+ *        If the function returns #GNUNET_SYSERR, its contents are undefined.
  * @param added length of created address
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
 typedef int (*GNUNET_TRANSPORT_StringToAddress) (void *cls,
                                                  const char *addr,

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2013-12-11 21:25:23 UTC 
(rev 31291)
+++ gnunet/src/transport/gnunet-service-transport.c     2013-12-11 22:50:10 UTC 
(rev 31292)
@@ -194,7 +194,7 @@
  *                for inbound TCP/UDP connections since it it not clear
  *                that we could establish ourselves a connection to that
  *                IP address and get the same system)
- * @param sender_address_len number of bytes in sender_address
+ * @param sender_address_len number of bytes in @a sender_address
  * @return how long the plugin should wait until receiving more data
  *         (plugins that do not support this, can ignore the return value)
  */

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-12-11 
21:25:23 UTC (rev 31291)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-12-11 
22:50:10 UTC (rev 31292)
@@ -378,7 +378,7 @@
    * from the map.  We should never find a 'struct NeighbourMapEntry'
    * in this state in the map.  Accessing a 'struct NeighbourMapEntry'
    * in this state virtually always means using memory that has been
-   * freed (the exception being the cleanup code in 'free_neighbour').
+   * freed (the exception being the cleanup code in #free_neighbour()).
    */
   S_DISCONNECT_FINISHED
 };
@@ -875,8 +875,8 @@
  * Free a neighbour map entry.
  *
  * @param n entry to free
- * @param keep_sessions GNUNET_NO to tell plugin to terminate sessions,
- *                      GNUNET_YES to keep all sessions
+ * @param keep_sessions #GNUNET_NO to tell plugin to terminate sessions,
+ *                      #GNUNET_YES to keep all sessions
  */
 static void
 free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
@@ -909,7 +909,7 @@
 
   if (NULL != n->primary_address.address)
   {
-    backup_primary = GNUNET_HELLO_address_copy(n->primary_address.address);
+    backup_primary = GNUNET_HELLO_address_copy (n->primary_address.address);
   }
   else
     backup_primary = NULL;
@@ -959,6 +959,7 @@
   GNUNET_free (n);
 }
 
+
 /**
  * Transmit a message using the current session of the given
  * neighbour.
@@ -1592,14 +1593,22 @@
   connect_msg.header.type = htons 
(GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
   connect_msg.reserved = htonl (0);
   connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp);
-  (void) papi->send (papi->cls,
-                    na->session,
-                    (const char *) &connect_msg, sizeof (struct 
SessionConnectMessage),
-                    UINT_MAX,
-                    GNUNET_TIME_UNIT_FOREVER_REL,
-                    NULL, NULL);
+  if (-1 ==
+      papi->send (papi->cls,
+                  na->session,
+                  (const char *) &connect_msg, sizeof (struct 
SessionConnectMessage),
+                  UINT_MAX,
+                  GNUNET_TIME_UNIT_FOREVER_REL,
+                  NULL, NULL))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _("Failed to transmit CONNECT message via plugin to %s\n"),
+                GST_plugins_a2s (na->address));
+  }
   GST_neighbours_notify_data_sent (&na->address->peer,
-      na->address, na->session, sizeof (struct SessionConnectMessage));
+                                   na->address,
+                                   na->session,
+                                   sizeof (struct SessionConnectMessage));
 
 }
 
@@ -2191,10 +2200,8 @@
                                  struct Session *session,
                                  const struct GNUNET_ATS_Information *ats,
                                  uint32_t ats_count,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_in,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_out)
+                                 struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in,
+                                 struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out)
 {
   struct NeighbourMapEntry *n;
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
@@ -3083,8 +3090,13 @@
         (S_CONNECT_SENT != n->state) ) ||
        (2 != n->send_connect_ack) )
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received SESSION_ACK message from peer `%s' in state %s/%d\n",
+                GNUNET_i2s (peer),
+                print_state (n->state),
+                n->send_connect_ack);
     GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# unexpected SESSION ACK 
messages"), 1,
+                              gettext_noop ("# unexpected SESSION_ACK 
messages"), 1,
                               GNUNET_NO);
     return;
   }

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-12-11 21:25:23 UTC (rev 
31291)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-12-11 22:50:10 UTC (rev 
31292)
@@ -139,10 +139,10 @@
  */
 struct IPv4TcpAddress
 {
-       /**
-        * Optional options and flags for this address
-        */
-       uint32_t options;
+  /**
+   * Optional options and flags for this address
+   */
+  uint32_t options;
 
   /**
    * IPv4 address, in network byte order.
@@ -162,10 +162,10 @@
  */
 struct IPv6TcpAddress
 {
-       /**
-        * Optional flags for this address
-        */
-       uint32_t options;
+  /**
+   * Optional flags for this address
+   */
+  uint32_t options;
 
   /**
    * IPv6 address.
@@ -314,12 +314,12 @@
   struct GNUNET_TIME_Absolute last_activity;
 
   /**
-   * Are we still expecting the welcome message? (GNUNET_YES/GNUNET_NO)
+   * Are we still expecting the welcome message? (#GNUNET_YES/#GNUNET_NO)
    */
   int expecting_welcome;
 
   /**
-   * Was this a connection that was inbound (we accepted)? 
(GNUNET_YES/GNUNET_NO)
+   * Was this a connection that was inbound (we accepted)? 
(#GNUNET_YES/#GNUNET_NO)
    */
   int inbound;
 
@@ -441,6 +441,8 @@
 
 /**
  * Cancel timeout
+ *
+ * @param s session to cancel timeout for
  */
 static void
 stop_session_timeout (struct Session *s);
@@ -458,34 +460,39 @@
 inc_sessions (struct Plugin *plugin, struct Session *session, int line)
 {
   sessions++;
-  unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap);
+  unsigned int size = GNUNET_CONTAINER_multipeermap_size (plugin->sessionmap);
   if (sessions != size)
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map 
size: %u\n",
-        sessions, size);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "%4i Session increased to %u (session map 
size: %u): `%s' `%s'\n",
-      line,
-      sessions,
-      size,
-      GNUNET_i2s (&session->target),
-      tcp_address_to_string (NULL, session->addr, session->addrlen));
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Inconsistent sessions %u <-> session map size: %u\n",
+         sessions, size);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "%4i Session increased to %u (session map size: %u): `%s' `%s'\n",
+       line,
+       sessions,
+       size,
+       GNUNET_i2s (&session->target),
+       tcp_address_to_string (NULL, session->addr, session->addrlen));
 }
 
 
 static void
-dec_sessions (struct Plugin *plugin, struct Session *session, int line)
+dec_sessions (struct Plugin *plugin,
+              struct Session *session, int line)
 {
   GNUNET_assert (sessions > 0);
   unsigned int size = GNUNET_CONTAINER_multipeermap_size(plugin->sessionmap);
   sessions--;
   if (sessions != size)
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Inconsistent sessions %u <-> session map 
size: %u\n",
-      sessions, size);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "%4i Session decreased to %u (session map 
size: %u): `%s' `%s'\n",
-      line,
-      sessions,
-      size,
-      GNUNET_i2s (&session->target),
-      tcp_address_to_string (NULL, session->addr, session->addrlen));
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Inconsistent sessions %u <-> session map size: %u\n",
+         sessions, size);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "%4i Session decreased to %u (session map size: %u): `%s' `%s'\n",
+       line,
+       sessions,
+       size,
+       GNUNET_i2s (&session->target),
+       tcp_address_to_string (NULL, session->addr, session->addrlen));
 }
 /* DEBUG CODE */
 
@@ -499,7 +506,7 @@
  * @param ucred credentials, if available, otherwise NULL
  * @param addr address
  * @param addrlen length of address
- * @return GNUNET_YES to allow, GNUNET_NO to deny, GNUNET_SYSERR
+ * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR
  *   for unknown address family (will be denied).
  */
 static int
@@ -522,7 +529,7 @@
  * Our external IP address/port mapping has changed.
  *
  * @param cls closure, the 'struct LocalAddrList'
- * @param add_remove GNUNET_YES to mean the new public IP address, GNUNET_NO 
to mean
+ * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO 
to mean
  *     the previous (now invalid) one
  * @param addr either the previous or the new public IP address
  * @param addrlen actual lenght of the address
@@ -647,12 +654,14 @@
  * @param addrlen length of the address
  * @param buf location to store the buffer
  * @param added location to store the number of bytes in the buffer.
- *        If the function returns GNUNET_SYSERR, its contents are undefined.
- * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ *        If the function returns #GNUNET_SYSERR, its contents are undefined.
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
 static int
-tcp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
-    void **buf, size_t *added)
+tcp_string_to_address (void *cls,
+                       const char *addr,
+                       uint16_t addrlen,
+                       void **buf, size_t *added)
 {
   struct sockaddr_storage socket_address;
   char *address;
@@ -1024,17 +1033,25 @@
 
   stop_session_timeout (session);
 
-  if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap, 
&session->target, session))
+  if (GNUNET_YES ==
+      GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap,
+                                            &session->target,
+                                            session))
   {
     GNUNET_STATISTICS_update (session->plugin->env->stats,
                              gettext_noop ("# TCP sessions active"), -1,
                              GNUNET_NO);
     dec_sessions (plugin, session, __LINE__);
   }
-  else GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove 
(plugin->nat_wait_conns, &session->target, session));
-
+  else
+  {
+    GNUNET_assert (GNUNET_YES ==
+                   GNUNET_CONTAINER_multipeermap_remove 
(plugin->nat_wait_conns,
+                                                         &session->target,
+                                                         session));
+  }
   /* clean up state */
-  if (session->transmit_handle != NULL)
+  if (NULL != session->transmit_handle)
   {
     GNUNET_SERVER_notify_transmit_ready_cancel (session->transmit_handle);
     session->transmit_handle = NULL;
@@ -1630,29 +1647,29 @@
 };
 
 
-
-void
-ppc_cancel_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+static void
+ppc_cancel_task (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-       int count = 0;
+  int count = 0;
   struct PrettyPrinterContext *ppc = cls;
   struct PrettyPrinterContext *cur;
-       for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
-       {
-               if (cur != 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)
-       {
-               GNUNET_RESOLVER_request_cancel (ppc->resolver_handle);
-               ppc->resolver_handle = NULL;
-       }
+  for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
+  {
+    if (cur != ppc)
+      count++;
+  }
 
-       GNUNET_CONTAINER_DLL_remove (ppc_dll_head, ppc_dll_tail, ppc);
-       GNUNET_free (ppc);
+  // 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)
+  {
+    GNUNET_RESOLVER_request_cancel (ppc->resolver_handle);
+    ppc->resolver_handle = NULL;
+  }
+  GNUNET_CONTAINER_DLL_remove (ppc_dll_head, ppc_dll_tail, ppc);
+  GNUNET_free (ppc);
 }
 
 
@@ -1670,12 +1687,12 @@
   char *ret;
   int count = 0;
 
-       for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
-       {
-               if (cur != ppc)
-                       count++;
-       }
-       //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Callback request %p == %s, %u 
pending\n", ppc, hostname, count);
+  for (cur = ppc_dll_head; (NULL != cur); cur = cur->next)
+  {
+    if (cur != ppc)
+      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);
@@ -1786,19 +1803,20 @@
   ppc->port = port;
   ppc->options = options;
   ppc->timeout_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_relative_multiply(timeout, 2),
-               &ppc_cancel_task, ppc);
-       ppc->resolver_handle =  GNUNET_RESOLVER_hostname_get (sb, sbs, !numeric,
-                       timeout, &append_port, ppc);
-       if (NULL != ppc->resolver_handle)
-       {
-               //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding request %p\n", 
ppc);
-               GNUNET_CONTAINER_DLL_insert (ppc_dll_head, ppc_dll_tail, ppc);
-       }
-       else
-       {
-               GNUNET_break (0);
-               GNUNET_free (ppc);
-       }
+                                                    &ppc_cancel_task, ppc);
+  ppc->resolver_handle = GNUNET_RESOLVER_hostname_get (sb, sbs, !numeric,
+                                                       timeout,
+                                                       &append_port, ppc);
+  if (NULL != ppc->resolver_handle)
+  {
+    //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding request %p\n", ppc);
+    GNUNET_CONTAINER_DLL_insert (ppc_dll_head, ppc_dll_tail, ppc);
+  }
+  else
+  {
+    GNUNET_break (0);
+    GNUNET_free (ppc);
+  }
 }
 
 
@@ -2372,7 +2390,7 @@
  *
  * @param cls closure
  * @param addr address to try
- * @param addrlen number of bytes in addr
+ * @param addrlen number of bytes in @a addr
  */
 static void
 try_connection_reversal (void *cls, const struct sockaddr *addr,
@@ -2421,9 +2439,9 @@
  * Session was idle, so disconnect it
  */
 static void
-session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+session_timeout (void *cls,
+                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_assert (NULL != cls);
   struct Session *s = cls;
 
   s->timeout_task = GNUNET_SCHEDULER_NO_TASK;
@@ -2433,7 +2451,7 @@
              GNUNET_STRINGS_relative_time_to_string 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                                      GNUNET_YES));
   /* call session destroy function */
-  disconnect_session(s);
+  disconnect_session (s);
 }
 
 
@@ -2445,7 +2463,7 @@
 {
   GNUNET_assert (NULL != s);
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == s->timeout_task);
-  s->timeout_task =  GNUNET_SCHEDULER_add_delayed 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+  s->timeout_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
                                                    &session_timeout,
                                                    s);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2466,9 +2484,9 @@
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != s->timeout_task);
 
   GNUNET_SCHEDULER_cancel (s->timeout_task);
-  s->timeout_task =  GNUNET_SCHEDULER_add_delayed 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-                                                   &session_timeout,
-                                                   s);
+  s->timeout_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+                                                  &session_timeout,
+                                                  s);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Timeout rescheduled for session %p set to %s\n",
              s,
@@ -2478,7 +2496,9 @@
 
 
 /**
- * Cancel timeout
+ * Cancel timeout.
+ *
+ * @param s session to cancel timeout for
  */
 static void
 stop_session_timeout (struct Session *s)
@@ -2634,7 +2654,7 @@
                                       GNUNET_YES, 0, 0, NULL, NULL, NULL,
                                       &try_connection_reversal, plugin);
   }
-  api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
+  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
   api->cls = plugin;
   api->send = &tcp_plugin_send;
   api->get_session = &tcp_plugin_get_session;
@@ -2716,23 +2736,26 @@
     GNUNET_free (api);
     return NULL;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down TCP plugin\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Shutting down TCP plugin\n");
 
   /* Removing leftover sessions */
-  GNUNET_CONTAINER_multipeermap_iterate(plugin->sessionmap, 
&session_disconnect_it, NULL);
+  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap,
+                                         &session_disconnect_it, NULL);
   /* Removing leftover NAT sessions */
-  GNUNET_CONTAINER_multipeermap_iterate(plugin->nat_wait_conns, 
&session_disconnect_it, NULL);
+  GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns,
+                                         &session_disconnect_it, NULL);
 
   next = ppc_dll_head;
   for (cur = next; NULL != cur; cur = next)
   {
-       next = cur->next;
-       GNUNET_CONTAINER_DLL_remove (ppc_dll_head, ppc_dll_tail, cur);
-       if (NULL != cur->resolver_handle)
-               GNUNET_RESOLVER_request_cancel (cur->resolver_handle);
-       GNUNET_SCHEDULER_cancel (cur->timeout_task);
-       GNUNET_free (cur);
-       GNUNET_break (0);
+    next = cur->next;
+    GNUNET_CONTAINER_DLL_remove (ppc_dll_head, ppc_dll_tail, cur);
+    if (NULL != cur->resolver_handle)
+      GNUNET_RESOLVER_request_cancel (cur->resolver_handle);
+    GNUNET_SCHEDULER_cancel (cur->timeout_task);
+    GNUNET_free (cur);
+    GNUNET_break (0);
   }
 
   if (plugin->service != NULL)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]