- use proper signedness
[oweals/gnunet.git] / src / transport / plugin_transport_tcp.c
index f2db47922f888b2587c5db7542f0b525031fe85d..04fac9cdecd841ec540d8438af85946616fa9bc5 100644 (file)
@@ -1285,7 +1285,6 @@ tcp_plugin_send (void *cls,
                                                     session))
   {
     GNUNET_assert (session->client != NULL);
-    reschedule_session_timeout (session);
     GNUNET_SERVER_client_set_timeout (session->client,
                                       GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
     GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1304,7 +1303,6 @@ tcp_plugin_send (void *cls,
     LOG (GNUNET_ERROR_TYPE_DEBUG,
         "This NAT WAIT session for peer `%s' is not yet ready!\n",
         GNUNET_i2s (&session->target));
-    reschedule_session_timeout (session);
     GNUNET_STATISTICS_update (plugin->env->stats,
                               gettext_noop ("# bytes currently in TCP buffers"),
                               msgbuf_size, GNUNET_NO);
@@ -1425,7 +1423,11 @@ tcp_plugin_update_session_timeout (void *cls,
                                   const struct GNUNET_PeerIdentity *peer,
                                   struct Session *session)
 {
+  struct Plugin *plugin = cls;
+  if (GNUNET_SYSERR == find_session (plugin, session))
+    return;
 
+  reschedule_session_timeout (session);
 }
 
 
@@ -1904,7 +1906,7 @@ tcp_plugin_address_pretty_printer (void *cls, const char *type,
     asc (asc_cls, NULL);
     return;
   }
-  ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext));
+  ppc = GNUNET_new (struct PrettyPrinterContext);
   if (addrlen == sizeof (struct IPv6TcpAddress))
     ppc->ipv6 = GNUNET_YES;
   else
@@ -2522,7 +2524,7 @@ try_connection_reversal (void *cls, const struct sockaddr *addr,
 
   /* FIXME: do we need to track these probe context objects so that
    * we can clean them up on plugin unload? */
-  tcp_probe_ctx = GNUNET_malloc (sizeof (struct TCPProbeContext));
+  tcp_probe_ctx = GNUNET_new (struct TCPProbeContext);
   tcp_probe_ctx->message.header.size =
       htons (sizeof (struct TCP_NAT_ProbeMessage));
   tcp_probe_ctx->message.header.type =