Extending the testcases to use bluetooth
[oweals/gnunet.git] / src / transport / gnunet-service-transport_neighbours.c
index 8886a344c22d0071ce9cb1dd44e77b9a05a134a0..269525a55fe8811859fd613ed3e990084c3341ba 100644 (file)
@@ -1543,7 +1543,7 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
   else
     latency = n->latency.rel_value;
   ats.value = htonl (latency);
-  GST_update_ats_metrics (&n->id,
+  GST_ats_update_metrics (&n->id,
                                                                                          n->primary_address.address,
                                                                                        n->primary_address.session,
                                                                                        &ats, 1);
@@ -1840,12 +1840,16 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
   struct NeighbourMapEntry *n;
 
   if (NULL == neighbours)  
-    return; /* during shutdown, do nothing */
+  {
+         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                     "Asked to connect to peer `%s' during shutdown\n",
+                     GNUNET_i2s (target));
+               return; /* during shutdown, do nothing */
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
              "Asked to connect to peer `%s'\n",
               GNUNET_i2s (target));
-  if (0 ==
-      memcmp (target, &GST_my_identity, sizeof (struct GNUNET_PeerIdentity)))
+  if (0 == memcmp (target, &GST_my_identity, sizeof (struct GNUNET_PeerIdentity)))
   {
     /* refuse to connect to myself */
     /* FIXME: can this happen? Is this not an API violation? */
@@ -1984,13 +1988,8 @@ handle_test_blacklist_cont (void *cls,
     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,
-                              NULL, 0);
-    }
+       GST_ats_add_address (bcc->na.address, bcc->na.session);
+
     n->state = S_CONNECT_RECV_ATS;
     n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
     GNUNET_ATS_reset_backoff (GST_ats, peer);
@@ -2798,10 +2797,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
                        n->primary_address.bandwidth_in,
                        n->primary_address.bandwidth_out);
     /* Tell ATS that the outbound session we created to send CONNECT was successfull */
-    GNUNET_ATS_address_add (GST_ats,
-                            n->primary_address.address,
-                            n->primary_address.session,
-                            NULL, 0);
+    GST_ats_add_address (n->primary_address.address, n->primary_address.session);
     set_address (&n->primary_address,
                 n->primary_address.address,
                 n->primary_address.session,
@@ -2846,10 +2842,8 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
     n->state = S_CONNECTED;
     n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
     GNUNET_break (GNUNET_NO == n->alternative_address.ats_active);
-    GNUNET_ATS_address_add(GST_ats,
-                           n->alternative_address.address,
-                           n->alternative_address.session,
-                           NULL, 0);
+
+    GST_ats_add_address (n->alternative_address.address, n->alternative_address.session);
     set_address (&n->primary_address,
                 n->alternative_address.address,
                 n->alternative_address.session,
@@ -3056,10 +3050,8 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
   connect_notify_cb (callback_cls, &n->id,
                      n->primary_address.bandwidth_in,
                      n->primary_address.bandwidth_out);
-  GNUNET_ATS_address_add(GST_ats,
-                         n->primary_address.address,
-                         n->primary_address.session,
-                         NULL, 0);
+
+  GST_ats_add_address (n->primary_address.address, n->primary_address.session);
   set_address (&n->primary_address,
               n->primary_address.address,
               n->primary_address.session,