gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22251 - gnunet/src/transport
Date: Sun, 24 Jun 2012 11:20:57 +0200

Author: grothoff
Date: 2012-06-24 11:20:57 +0200 (Sun, 24 Jun 2012)
New Revision: 22251

Modified:
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
-attempting to fix LRN's NAT connect issue

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2012-06-24 
09:05:45 UTC (rev 22250)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2012-06-24 
09:20:57 UTC (rev 22251)
@@ -1749,6 +1749,15 @@
               (GNUNET_OK == result) ? "allowed" : "FORBIDDEN");
   if (NULL == (n = lookup_neighbour (peer)))
     goto cleanup; /* nobody left to care about new address */
+  if (GNUNET_OK == result)
+  {
+    /* valid new address, let ATS know (regardless of where we are
+       in the state machine) */
+    GNUNET_ATS_address_add (GST_ats,
+                           bcc->na.address,
+                           bcc->na.session,
+                           bcc->ats, bcc->ats_count);
+  }
   switch (n->state)
   {
   case S_NOT_CONNECTED:
@@ -1792,25 +1801,31 @@
     }
     break;
   case S_CONNECT_SENT:
-    /* waiting on CONNECT_ACK, send ACK if one is pending */
+    /* waiting on CONNECT_ACK, switch session and send ACK if one is pending */
     if ( (GNUNET_OK == result) &&
         (1 == n->send_connect_ack) )
     {
       n->send_connect_ack = 2;
+      /* FIXME: we might be switching to a different address here without
+        asking (or telling!) ATS; while this is done for a good reason --
+        our CONNECT was not answered, but we got another session with
+        a CONNECT from the other peer, so maybe this is an inbound session
+        that actually works -- this is unclean as ATS needs to be told
+        about this (or even asked first!?) Anyway, I'm adding this as
+        something expermental for now to see if it fixes issues LRN reported
+        on IRC on 24/6/2012.  */
+      set_address (&n->primary_address,
+                  bcc->na.address,
+                  bcc->na.session,
+                  n->primary_address.bandwidth_in,
+                  n->primary_address.bandwidth_out,
+                  GNUNET_YES);
       send_session_connect_ack_message (n->primary_address.address,
                                        n->primary_address.session,
                                        n->connect_ack_timestamp);
     }
     break; 
   case S_CONNECT_RECV_BLACKLIST_INBOUND:
-    if (GNUNET_OK == result)
-    {
-      /* valid new address, let ATS know! */
-      GNUNET_ATS_address_add (GST_ats,
-                              bcc->na.address,
-                              bcc->na.session,
-                              bcc->ats, bcc->ats_count);
-    }
     n->state = S_CONNECT_RECV_ATS;
     n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
     GNUNET_ATS_reset_backoff (GST_ats, peer);
@@ -2091,9 +2106,8 @@
     /* get rid of remains without terminating sessions, ready to re-try */
     free_neighbour (n, GNUNET_YES);
     n = setup_neighbour (peer);
-    n->state = S_CONNECT_RECV_ATS;
-    GNUNET_ATS_reset_backoff (GST_ats, peer);
-    GNUNET_ATS_suggest_address (GST_ats, peer);
+    n->state = S_CONNECT_RECV_BLACKLIST_INBOUND;
+    check_blacklist (peer, ts, address, session, ats, ats_count);
     break;
   case S_DISCONNECT_FINISHED:
     /* should not be possible */




reply via email to

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