gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27902 - gnunet/src/transport
Date: Thu, 11 Jul 2013 11:37:13 +0200

Author: wachs
Date: 2013-07-11 11:37:13 +0200 (Thu, 11 Jul 2013)
New Revision: 27902

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
fix:

return address length 0 for inbound session
- return session only if inbound flag is set:
issue because plugin sends TCP_WELCOME messages for incoming connections not 
only outbount



Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-07-11 09:15:06 UTC (rev 
27901)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-07-11 09:37:13 UTC (rev 
27902)
@@ -616,6 +616,12 @@
     memcpy (&a4, &t4->ipv4_addr, sizeof (a4));
     sb = &a4;
     break;
+  case 0:
+    {
+      GNUNET_snprintf (rbuf, sizeof (rbuf), "%s",
+               "<inbound>");
+      return rbuf;
+    }
   default:
     LOG (GNUNET_ERROR_TYPE_WARNING,
                _("Unexpected address length: %u bytes\n"),
@@ -1355,7 +1361,7 @@
     if (si_ctx.result != NULL)
     {
       session = si_ctx.result;
-      LOG (GNUNET_ERROR_TYPE_DEBUG, 
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
           "Found existing session for `%s' address `%s' session %p\n",
           GNUNET_i2s (&address->peer),
           tcp_address_to_string(NULL, address->address, 
address->address_length),
@@ -1676,7 +1682,7 @@
   }
   else if (0 == addrlen)
   {
-    asc (asc_cls, "<inbound connection>");
+    asc (asc_cls, "<inbound>");
     asc (asc_cls, NULL);
     return;
   }
@@ -2031,12 +2037,15 @@
   session->last_activity = GNUNET_TIME_absolute_get ();
   session->expecting_welcome = GNUNET_NO;
 
-
   /* Notify transport and ATS about new session */
-  plugin->env->session_start (NULL, &wm->clientIdentity,
-               PLUGIN_NAME, session->addr, session->addrlen, session, &ats, 1);
+  if (GNUNET_YES == session->inbound)
+  {
+       plugin->env->session_start (NULL, &wm->clientIdentity, PLUGIN_NAME,
+               (GNUNET_YES == session->inbound) ? NULL : session->addr,
+                 (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
+                 session, &ats, 1);
+  }
 
-
   process_pending_messages (session);
 
   GNUNET_SERVER_client_set_timeout (client,
@@ -2154,10 +2163,8 @@
   plugin->env->update_address_metrics (plugin->env->cls,
                &session->target,
                (GNUNET_YES == session->inbound) ? NULL : session->addr,
-                                      (GNUNET_YES == session->inbound) ? 0 : 
session->addrlen,
-                                      session,
-                                      &distance,
-                                      1);
+                 (GNUNET_YES == session->inbound) ? 0 : session->addrlen,
+                 session, &distance, 1);
 
   reschedule_session_timeout (session);
 




reply via email to

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