gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r22021 - in gnunet/src: ats transport


From: gnunet
Subject: [GNUnet-SVN] r22021 - in gnunet/src: ats transport
Date: Fri, 15 Jun 2012 15:11:46 +0200

Author: wachs
Date: 2012-06-15 15:11:46 +0200 (Fri, 15 Jun 2012)
New Revision: 22021

Modified:
   gnunet/src/ats/ats_api_scheduling.c
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/gnunet-service-transport_validation.c
Log:
- changed behavior when receiving CONNECT messages ... inbound session and NAT 
tests work again


Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2012-06-15 11:21:36 UTC (rev 22020)
+++ gnunet/src/ats/ats_api_scheduling.c 2012-06-15 13:11:46 UTC (rev 22021)
@@ -384,9 +384,6 @@
                        sh->session_array_size * 2);
   }
   GNUNET_assert (f > 0);
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api",
-              "Session %p for peer `%s' stored in slot %u \n",
-              session, GNUNET_i2s (peer), f);
   sh->session_array[f].session = session;
   sh->session_array[f].peer = *peer;
   sh->session_array[f].slot_used = GNUNET_YES;
@@ -1117,8 +1114,11 @@
     s = find_session_id (sh, session, &address->peer);
     if (NOT_FOUND != s)
     {
-      /* Already existing */
-      GNUNET_break (0);
+      /* Already existing, nothing todo */
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Adding duplicate address for peer `%s', plugin `%s', 
session %p id %u\n",
+                  GNUNET_i2s (&address->peer),
+                  address->transport_name, session, s);
       return GNUNET_SYSERR;
     }
     s = find_empty_session_slot (sh, session, &address->peer);
@@ -1213,12 +1213,8 @@
   {
     s = find_session_id (sh, session, &address->peer);
     if (NOT_FOUND == s)
-    {
-      /* new session without slot, find one */
-      s = find_empty_session_slot (sh, session, &address->peer);
-      GNUNET_break (NOT_FOUND != s);
+      GNUNET_break (0);
       return;
-    }
   }
   m->session_id = htonl (s);
 
@@ -1272,7 +1268,7 @@
     return;
   }
 
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Trying to set address to %s for peer `%s', plugin `%s', session 
%p\n",
               GNUNET_i2s (&address->peer),
               (GNUNET_NO == in_use) ? "NO" : "YES",

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2012-06-15 11:21:36 UTC 
(rev 22020)
+++ gnunet/src/transport/gnunet-service-transport.c     2012-06-15 13:11:46 UTC 
(rev 22021)
@@ -287,11 +287,6 @@
     break;
   }
 end:
-#if 1
-  /* FIXME: this should not be needed, and not sure it's good to have it, but 
without
-   * this connections seem to go extra-slow */
-  GNUNET_ATS_address_update (GST_ats, &address, session, ats, ats_count);
-#endif
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Allowing receive from peer %s to continue in %llu ms\n",
               GNUNET_i2s (peer), (unsigned long long) ret.rel_value);

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2012-06-15 
11:21:36 UTC (rev 22020)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2012-06-15 
13:11:46 UTC (rev 22021)
@@ -221,10 +221,10 @@
  * Possible state of a neighbour.  Initially, we are S_NOT_CONNECTED.
  *
  * Then, there are two main paths. If we receive a CONNECT message, we
- * first run a check against the blacklist and ask ATS for a
- * suggestion.  (S_CONNECT_RECV_ATS).  If the blacklist comes back
- * positive, we give the address to ATS.  If ATS makes a suggestion,
- * we ALSO give that suggestion to the blacklist
+ * first run a check against the blacklist (S_CONNECT_RECV_BLACKLIST_INBOUND).
+ * If this check is successful, we give the inbound address to ATS.
+ * After the check we ask ATS for a suggestion (S_CONNECT_RECV_ATS).
+ * If ATS makes a suggestion, we ALSO give that suggestion to the blacklist
  * (S_CONNECT_RECV_BLACKLIST).  Once the blacklist approves the
  * address we got from ATS, we send our CONNECT_ACK and go to
  * S_CONNECT_RECV_ACK.  If we receive a SESSION_ACK, we go to
@@ -302,6 +302,11 @@
   S_CONNECT_SENT,
 
   /**
+   * Received a CONNECT, do a blacklist check for inbound address
+   */
+  S_CONNECT_RECV_BLACKLIST_INBOUND,
+
+  /**
    * Received a CONNECT, asking ATS about address suggestions.
    */
   S_CONNECT_RECV_ATS,
@@ -639,6 +644,9 @@
   case S_CONNECT_SENT:
     return "S_CONNECT_SENT";
     break;
+  case S_CONNECT_RECV_BLACKLIST_INBOUND:
+    return "S_CONNECT_RECV_BLACKLIST_INBOUND";
+    break;
   case S_CONNECT_RECV_ATS:
     return "S_CONNECT_RECV_ATS";
     break;
@@ -832,7 +840,6 @@
   if (GNUNET_YES == is_active)
   {
     /* Telling ATS about new session */
-    GNUNET_ATS_address_add (GST_ats, na->address, na->session, NULL, 0);
     GNUNET_ATS_address_in_use (GST_ats, na->address, na->session, GNUNET_YES);
     GST_validation_set_address_use (na->address, na->session, GNUNET_YES,  
__LINE__);
 
@@ -1728,14 +1735,6 @@
               "Connection to new address of peer `%s' based on blacklist is 
`%s'\n",
               GNUNET_i2s (peer),
               (GNUNET_OK == result) ? "allowed" : "FORBIDDEN");
-  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);
-  }
   if (NULL == (n = lookup_neighbour (peer)))
     goto cleanup; /* nobody left to care about new address */
   switch (n->state)
@@ -1791,9 +1790,23 @@
                                        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);
+    GNUNET_ATS_suggest_address (GST_ats, peer);
+    break;
   case S_CONNECT_RECV_ATS:
     /* still waiting on ATS suggestion, don't care about blacklist */
-    break; 
+    break;
   case S_CONNECT_RECV_BLACKLIST:
     if (GNUNET_YES != address_matches (&bcc->na, &n->primary_address))
       break; /* result for an address we currently don't care about */
@@ -2016,10 +2029,8 @@
   switch (n->state)
   {  
   case S_NOT_CONNECTED:
-    n->state = S_CONNECT_RECV_ATS;
-    n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
-    GNUNET_ATS_reset_backoff (GST_ats, peer);
-    GNUNET_ATS_suggest_address (GST_ats, peer);
+    n->state = S_CONNECT_RECV_BLACKLIST_INBOUND;
+    /* Do a blacklist check for the new address */
     check_blacklist (peer, ts, address, session, ats, ats_count);
     break;
   case S_INIT_ATS:
@@ -2352,6 +2363,17 @@
       return;
     }
     break;
+  case S_CONNECT_RECV_BLACKLIST_INBOUND:
+    if (0 == delay.rel_value)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Connection to `%s' timed out waiting BLACKLIST to approve 
address to use for received CONNECT\n",
+                  GNUNET_i2s (&n->id));
+      n->state = S_DISCONNECT_FINISHED;
+      free_neighbour (n, GNUNET_NO);
+      return;
+    }
+    break;
   case S_CONNECT_RECV_ATS:
     if (0 == delay.rel_value)
     {

Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c  2012-06-15 
11:21:36 UTC (rev 22020)
+++ gnunet/src/transport/gnunet-service-transport_validation.c  2012-06-15 
13:11:46 UTC (rev 22021)
@@ -1091,7 +1091,6 @@
   ve->latency = GNUNET_TIME_absolute_get_duration (ve->send_time);
   {
     struct GNUNET_ATS_Information ats;
-
     ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
     ats.value = htonl ((uint32_t) ve->latency.rel_value);
     GNUNET_ATS_address_add (GST_ats, ve->address, NULL, &ats, 1);




reply via email to

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