gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r21508 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r21508 - gnunet/src/transport
Date: Tue, 15 May 2012 18:58:41 +0200

Author: grothoff
Date: 2012-05-15 18:58:41 +0200 (Tue, 15 May 2012)
New Revision: 21508

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
-cleanup

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2012-05-15 16:34:03 UTC (rev 
21507)
+++ gnunet/src/transport/plugin_transport_tcp.c 2012-05-15 16:58:41 UTC (rev 
21508)
@@ -651,7 +651,9 @@
   struct Session *ret;
 };
 
-int session_lookup_by_client_it (void *cls,
+
+static int 
+session_lookup_by_client_it (void *cls,
                const GNUNET_HashCode * key,
                void *value)
 {
@@ -666,6 +668,7 @@
   return GNUNET_YES;
 }
 
+
 /**
  * Find the session handle for the given client.
  *
@@ -678,11 +681,10 @@
                         const struct GNUNET_SERVER_Client *client)
 {
   struct SessionClientCtx sc_ctx;
+
   sc_ctx.client = client;
   sc_ctx.ret = NULL;
-
   GNUNET_CONTAINER_multihashmap_iterate (plugin->sessionmap, 
&session_lookup_by_client_it, &sc_ctx);
-
   return sc_ctx.ret;
 }
 
@@ -714,10 +716,6 @@
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
                    "Creating new session for peer `%4s'\n",
                    GNUNET_i2s (target));
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-             "Creating new TCP session for peer `%s'\n",
-             GNUNET_i2s (target));
-
   ret = GNUNET_malloc (sizeof (struct Session));
   ret->last_activity = GNUNET_TIME_absolute_get ();
   ret->plugin = plugin;
@@ -1298,7 +1296,6 @@
         &nat_connect_timeout,
         session);
     GNUNET_assert (session != NULL);
-
     GNUNET_assert (GNUNET_CONTAINER_multihashmap_put
                    (plugin->nat_wait_conns, &address->peer.hashPubKey, session,
                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) == 
GNUNET_OK);
@@ -1395,20 +1392,11 @@
 tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
 {
   struct Plugin *plugin = cls;
-  struct Session *nat_session = NULL;
 
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
                    "Disconnecting peer `%4s'\n", GNUNET_i2s (target));
-
-  GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap, 
&target->hashPubKey, session_disconnect_it, plugin);
-
-  nat_session = GNUNET_CONTAINER_multihashmap_get(plugin->nat_wait_conns, 
&target->hashPubKey);
-  if (nat_session != NULL)
-  {
-    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
-                     "Cleaning up pending NAT session for peer `%4s'\n", 
GNUNET_i2s (target));
-    disconnect_session (nat_session);
-  }
+  GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessionmap, 
&target->hashPubKey, &session_disconnect_it, plugin);
+  GNUNET_CONTAINER_multihashmap_get_multiple (plugin->nat_wait_conns, 
&session_disconnect_it, plugin);
 }
 
 
@@ -1776,14 +1764,12 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-
   GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
                    "Received %s message from `%4s'\n", "WELCOME",
                    GNUNET_i2s (&wm->clientIdentity));
   GNUNET_STATISTICS_update (plugin->env->stats,
                             gettext_noop ("# TCP WELCOME messages received"), 
1,
                             GNUNET_NO);
-
   session = lookup_session_by_client (plugin, client);
   if (session != NULL)
   {
@@ -1801,7 +1787,6 @@
     GNUNET_SERVER_client_keep (client);
     session = create_session (plugin, &wm->clientIdentity, client, GNUNET_NO);
     session->inbound = GNUNET_YES;
-
     if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
     {
       if (alen == sizeof (struct sockaddr_in))




reply via email to

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