gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r17627 - gnunet/src/transport
Date: Thu, 20 Oct 2011 13:13:45 +0200

Author: grothoff
Date: 2011-10-20 13:13:45 +0200 (Thu, 20 Oct 2011)
New Revision: 17627

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
do not destroy session twice, do destroy address on failed connect

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-10-20 11:13:26 UTC 
(rev 17626)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-10-20 11:13:45 UTC 
(rev 17627)
@@ -368,7 +368,7 @@
                     "Telling ATS to destroy session %p from peer %s\n",
                     session,              
                     GNUNET_i2s (peer));
-  GNUNET_ATS_address_destroyed(GST_ats, peer, NULL, NULL, 0, session);
+  GNUNET_ATS_address_destroyed (GST_ats, peer, NULL, NULL, 0, session);
   GST_neighbours_session_terminated (peer, session);
 }
 

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-10-20 
11:13:26 UTC (rev 17626)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2011-10-20 
11:13:45 UTC (rev 17627)
@@ -620,6 +620,35 @@
 
 
 /**
+ * We tried to send a SESSION_CONNECT message to another peer.  If this
+ * succeeded, we should mark the peer up.  If it failed, we should tell
+ * ATS to not use this address anymore (until it is re-validated).
+ *
+ * @param cls the 'struct NeighbourMapEntry'
+ * @param success GNUNET_OK on success
+ */
+static void
+send_connect_continuation (void *cls,
+                          int success)
+{
+  struct NeighbourMapEntry *n = cls;
+
+  if (GNUNET_YES == n->in_disconnect)
+    return; /* neighbour is going away */
+  if (GNUNET_YES != success)
+  {
+    GNUNET_ATS_address_destroyed (GST_ats,
+                                 &n->id,
+                                 n->plugin_name, 
+                                 n->addr,
+                                 n->addrlen,
+                                 NULL);
+    return;
+  }
+}
+
+
+/**
  * For an existing neighbour record, set the active connection to
  * the given address.
  *
@@ -647,16 +676,11 @@
   n = lookup_neighbour (peer);
   if (NULL == n)
   {
-    if (NULL != session)
-      GNUNET_log_from (GNUNET_ERROR_TYPE_INFO  | GNUNET_ERROR_TYPE_BULK,
-                      "transport-ats",
-                      "Telling ATS to destroy session %p of peer %s\n",
-                      session,                
-                      GNUNET_i2s (peer));
-    GNUNET_ATS_address_destroyed (GST_ats,
-                                 peer,
-                                 plugin_name, address,
-                                 address_len, session);
+    if (NULL == session)
+      GNUNET_ATS_address_destroyed (GST_ats,
+                                   peer,
+                                   plugin_name, address,
+                                   address_len, NULL);    
     return;
   }
   was_connected = n->is_connected;
@@ -693,7 +717,9 @@
   connect_msg.timestamp =
       GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
   GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg),
-                       GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL);
+                       GNUNET_TIME_UNIT_FOREVER_REL, 
+                      &send_connect_continuation, 
+                      n);
   if (GNUNET_YES == was_connected)
     return;
   /* First tell clients about connected neighbours...*/
@@ -807,16 +833,6 @@
               "Session %X to peer `%s' ended \n",
               session, GNUNET_i2s (peer));
 #endif
-  if (NULL != session)
-    GNUNET_log_from (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
-                    "transport-ats",
-                    "Telling ATS to destroy session %p of peer %s\n",
-                    session,               
-                    GNUNET_i2s (peer));
-  GNUNET_ATS_address_destroyed (GST_ats,
-                               peer,
-                               NULL, NULL, 0,
-                               session);
   n = lookup_neighbour (peer);
   if (NULL == n)
     return;




reply via email to

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