-improve indentation, reduce duplication of PIDs in core's neighbour map
[oweals/gnunet.git] / src / transport / gnunet-service-transport_plugins.c
index 1571cee712d6ad3760920d24d693292e81a68ac4..c16142e39f83ff15f893bfa6673109e8f791cc18 100644 (file)
@@ -14,8 +14,8 @@
 
   You should have received a copy of the GNU General Public License
   along with GNUnet; see the file COPYING.  If not, write to the
-  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-  Boston, MA 02111-1307, USA.
+  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -85,19 +85,15 @@ static struct TransportPlugin *plugins_tail;
  * @param cls closure
  * @param address address to update metrics for
  * @param session the session
- * @param ats the ats information to update
- * @param ats_count the number of @a ats elements
+ * @param distance new distance
  */
 static void
-plugin_env_update_metrics (void *cls,
-                           const struct GNUNET_HELLO_Address *address,
-                           struct Session *session,
-                           const struct GNUNET_ATS_Information *ats,
-                           uint32_t ats_count)
+plugin_env_update_distance (void *cls,
+                            const struct GNUNET_HELLO_Address *address,
+                            uint32_t distance)
 {
-  GST_ats_update_metrics (address,
-                          session,
-                          ats, ats_count);
+  GST_ats_update_distance (address,
+                           distance);
 }
 
 
@@ -191,7 +187,7 @@ GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
     plug->env.session_start = session_start_cb;
     plug->env.session_end = session_end_cb;
     plug->env.get_address_type = &plugin_env_address_to_type;
-    plug->env.update_address_metrics = &plugin_env_update_metrics;
+    plug->env.update_address_distance = &plugin_env_update_distance;
     plug->env.max_connections = tneigh;
     plug->env.stats = GST_stats;
     GNUNET_CONTAINER_DLL_insert (plugins_head,
@@ -413,17 +409,26 @@ GST_plugins_a2s (const struct GNUNET_HELLO_Address *address)
     return TRANSPORT_SESSION_INBOUND_STRING; /* Addresse with length 0 are inbound, address->address itself may be NULL */
   api = GST_plugins_printer_find (address->transport_name);
   if (NULL == api)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Failed to find transport plugin `%s'\n",
+                address->transport_name);
     return "<plugin unknown>";
+  }
   if (0 == address->address_length)
   {
-    GNUNET_snprintf (unable_to_show, sizeof (unable_to_show),
+    GNUNET_snprintf (unable_to_show,
+                     sizeof (unable_to_show),
                      "<unable to stringify %u-byte long address of %s transport>",
                      (unsigned int) address->address_length,
                      address->transport_name);
     return unable_to_show;
   }
-  return (NULL != (s = api->address_to_string (NULL, address->address,
-                                 address->address_length)) ? s : "<invalid>");
+  return (NULL != (s = api->address_to_string (NULL,
+                                               address->address,
+                                               address->address_length))
+          ? s
+          : "<invalid>");
 }
 
 
@@ -444,7 +449,8 @@ GST_plugins_monitor_subscribe (GNUNET_TRANSPORT_SessionInfoCallback cb,
       GNUNET_break (0);
     else
       pos->api->setup_monitor (pos->api->cls,
-                              cb, cb_cls);
+                              cb,
+                              cb_cls);
 }