Extended ATS and transport service to store session IDs to support inbound sessions
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 25 Aug 2011 13:25:57 +0000 (13:25 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 25 Aug 2011 13:25:57 +0000 (13:25 +0000)
src/ats/ats_api.c
src/include/gnunet_ats_service.h
src/transport/gnunet-service-transport_clients.c
src/transport/gnunet-service-transport_neighbours.c

index aee7fd8864f3701c6d9a6148397c3cf211f3d8df..4f791050d23c8e26b4f468c438eb79912a5e7ce9 100644 (file)
@@ -286,6 +286,7 @@ suggest_address (void *cls, const GNUNET_HashCode * key, void *value)
   /* trivial strategy: pick first available address... */
   asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
            ar->plugin_addr_len,
+           ar->session,
            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
            ar->ats_count);
   asc->cb = NULL;
@@ -682,6 +683,7 @@ notify_valid (void *cls, const GNUNET_HashCode * key, void *value)
 
   asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr,
            ar->plugin_addr_len,
+           ar->session,
            GNUNET_BANDWIDTH_value_init (asc->atc->total_bps / 32), ar->ats,
            ar->ats_count);
   GNUNET_ATS_suggest_address_cancel (asc);
index 1de3d104193f59d2d757980d8e7c9ef2c390ab06..618eab0a6cfaddaebb6721135188b95d2bd1abfb 100644 (file)
@@ -117,6 +117,7 @@ typedef void (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
                                                       const char *plugin_name,
                                                       const void *plugin_addr,
                                                       size_t plugin_addr_len,
+                                                      struct Session *session,
                                                       struct
                                                       GNUNET_BANDWIDTH_Value32NBO
                                                       bandwidth,
index 3ad2149bbc3335eeaa7f772f8e2bea2b9f35f4ed..05ccbe60b4913989cefdfe546fdef938ceb7f1cb 100644 (file)
@@ -493,6 +493,10 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client,
   if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer))
   {
     /* not connected, not allowed to send; can happen due to asynchronous operations */
+#if DEBUG_TRANSPORT
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Could not send message to peer `%s': not connected\n", GNUNET_i2s (&obm->peer));
+#endif
     GNUNET_STATISTICS_update (GST_stats,
                               gettext_noop
                               ("# bytes payload dropped (other peer was not connected)"),
index 172db755bf349b0d5c376266e7a260d215fc16a8..306924d12d6e62aeef1b7838046e1b2b2e410a04 100644 (file)
@@ -318,6 +318,8 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
   GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq);
   n->is_active = mq;
   mq->n = n;
+
+
   ret =
       papi->send (papi->cls, &n->id, mq->message_buf, mq->message_buf_size,
                   0 /* priority -- remove from plugin API? */ ,
@@ -514,6 +516,16 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
     GNUNET_break (0);
     return;
   }
+
+#if DEBUG_TRANSPORT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SWITCH! Peer `%4s' switches to plugin `%s' address '%s' session %X\n",
+              GNUNET_i2s (peer),
+              plugin_name,
+              (address_len == 0) ? "<inbound>" :
+              GST_plugins_a2s(plugin_name,address,address_len),
+              session);
+#endif
+
   GNUNET_free_non_null (n->addr);
   n->addr = GNUNET_malloc (address_len);
   memcpy (n->addr, address, address_len);
@@ -551,6 +563,7 @@ static void
 try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target,
                            const char *plugin_name, const void *plugin_address,
                            size_t plugin_address_len,
+                           struct Session *session,
                            struct GNUNET_BANDWIDTH_Value32NBO bandwidth,
                            const struct GNUNET_TRANSPORT_ATS_Information *ats,
                            uint32_t ats_count)
@@ -559,7 +572,7 @@ try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target,
 
   n->asc = NULL;
   GST_neighbours_switch_to_address (target, plugin_name, plugin_address,
-                                    plugin_address_len, NULL, ats, ats_count);
+                                    plugin_address_len, session, ats, ats_count);
   if (GNUNET_YES == n->is_connected)
     return;
   n->is_connected = GNUNET_YES;