gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r29923 - gnunet/src/transport
Date: Mon, 7 Oct 2013 15:58:09 +0200

Author: wachs
Date: 2013-10-07 15:58:09 +0200 (Mon, 07 Oct 2013)
New Revision: 29923

Modified:
   gnunet/src/transport/plugin_transport_unix.c
   gnunet/src/transport/plugin_transport_wlan.c
Log:
fix for incoming addresses:
incoming addresses are only marked with address length 0 if the address cannot 
be used to initiate a connection to his address. 
Therefor only for tcp and http(s) incoming connections an address length of 0 
is reported whereas for other plugins (unix, udp, wlan) the incoming address 
can be used to initiate a connection to this address.


Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2013-10-07 13:33:57 UTC 
(rev 29922)
+++ gnunet/src/transport/plugin_transport_unix.c        2013-10-07 13:58:09 UTC 
(rev 29923)
@@ -985,7 +985,7 @@
     s->inbound = GNUNET_YES;
     /* Notify transport and ATS about new inbound session */
     plugin->env->session_start (NULL, sender,
-               PLUGIN_NAME, NULL, 0, s, &plugin->ats_network, 1);
+               PLUGIN_NAME, ua, ua_len, s, &plugin->ats_network, 1);
   }
   reschedule_session_timeout (s);
 
@@ -1288,40 +1288,37 @@
 unix_address_to_string (void *cls, const void *addr, size_t addrlen)
 {
   static char rbuf[1024];
-       struct UnixAddress *ua = (struct UnixAddress *) addr;
-       char *addrstr;
-       size_t addr_str_len;
+  struct UnixAddress *ua = (struct UnixAddress *) addr;
+  char *addrstr;
+  size_t addr_str_len;
 
-       if (0 == addrlen)
-       {
-               GNUNET_snprintf(rbuf, sizeof (rbuf), "%s", 
TRANSPORT_SESSION_INBOUND_STRING);
-       }
   if ((NULL == addr) || (sizeof (struct UnixAddress) > addrlen))
   {
-    GNUNET_break (0);
-    return NULL;
+    GNUNET_break(0);
+    return NULL ;
   }
-       addrstr = (char *) &ua[1];
-       addr_str_len = ntohl (ua->addrlen);
+  addrstr = (char *) &ua[1];
+  addr_str_len = ntohl (ua->addrlen);
 
-       if (addr_str_len != addrlen - sizeof (struct UnixAddress))
+  if (addr_str_len != addrlen - sizeof(struct UnixAddress))
   {
-    GNUNET_break (0);
-    return NULL;
+    GNUNET_break(0);
+    return NULL ;
   }
 
   if ('\0' != addrstr[addr_str_len - 1])
   {
-    GNUNET_break (0);
-    return NULL;
+    GNUNET_break(0);
+    return NULL ;
   }
   if (strlen (addrstr) + 1 != addr_str_len)
   {
-    GNUNET_break (0);
-    return NULL;
+    GNUNET_break(0);
+    return NULL ;
   }
 
-  GNUNET_snprintf(rbuf, sizeof (rbuf), "%s.%u.%s", PLUGIN_NAME, ntohl 
(ua->options), addrstr);
+  GNUNET_snprintf (rbuf, sizeof(rbuf), "%s.%u.%s", PLUGIN_NAME,
+      ntohl (ua->options), addrstr);
   return rbuf;
 }
 

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2013-10-07 13:33:57 UTC 
(rev 29922)
+++ gnunet/src/transport/plugin_transport_wlan.c        2013-10-07 13:58:09 UTC 
(rev 29923)
@@ -1367,14 +1367,15 @@
       break;
     }
     xmas.endpoint = mas->endpoint;
-    if (NULL == (xmas.session =  lookup_session (mas->endpoint, 
&wlanheader->sender, GNUNET_YES)))
+    if (NULL == (xmas.session = lookup_session (mas->endpoint, 
&wlanheader->sender, GNUNET_YES)))
     {
-       xmas.session = create_session (mas->endpoint, &wlanheader->sender, 
GNUNET_YES);
-       plugin->env->session_start (NULL, &wlanheader->sender,
-                       PLUGIN_NAME, NULL, 0, xmas.session, NULL, 0);
+      xmas.session = create_session (mas->endpoint, &wlanheader->sender, 
GNUNET_YES);
+      plugin->env->session_start (NULL, &wlanheader->sender,
+          PLUGIN_NAME, &mas->endpoint->addr,
+          sizeof (struct WlanAddress), xmas.session, NULL, 0);
       LOG (GNUNET_ERROR_TYPE_DEBUG,
-               "Notifying transport about peer `%s''s new inbound session %p 
\n",
-               GNUNET_i2s (&wlanheader->sender), xmas.session);
+          "Notifying transport about peer `%s''s new inbound session %p \n",
+          GNUNET_i2s (&wlanheader->sender), xmas.session);
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
                "Processing %u bytes of WLAN DATA from peer `%s'\n",




reply via email to

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