speeling and coverity fix
[oweals/gnunet.git] / src / transport / plugin_transport_http.c
index ad8ced5678a152457383e3335dccf1a693a6b0e6..a39893a8643c58ab215b6034ba336a43d99384e4 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file transport/plugin_transport_http.c
+ * @file transport/gnunet_transport_plugin.http.c
  * @brief http transport service plugin
  * @author Matthias Wachs
  */
@@ -35,7 +35,7 @@
 #include "gnunet_resolver_service.h"
 #include "gnunet_server_lib.h"
 #include "gnunet_container_lib.h"
-#include "plugin_transport.h"
+#include "gnunet_transport_plugin.h"
 #include "gnunet_os_lib.h"
 #include "microhttpd.h"
 #include <curl/curl.h>
@@ -873,9 +873,18 @@ static void mhd_write_mst_cb (void *cls,
               ntohs(message->size),
              GNUNET_i2s(&(ps->peercontext)->identity),http_plugin_address_to_string(NULL,ps->addr,ps->addrlen));
 #endif
+  struct GNUNET_TRANSPORT_ATS_Information distance[2];
+  distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+  distance[0].value = htonl (1);
+  distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+  distance[1].value = htonl (0);
+
   delay = pc->plugin->env->receive (ps->peercontext->plugin->env->cls,
                                                                                                                  &pc->identity,
-                                                                                                                 message, 1, ps,
+                                                                                                                 message,
+                                                                                                                 (const struct GNUNET_TRANSPORT_ATS_Information *) &distance,
+                                                                                                                 2,
+                                                                                                                 ps,
                                                                                                                  NULL,
                                                                                                                  0);
   pc->delay = delay;
@@ -1576,9 +1585,17 @@ static void curl_receive_mst_cb  (void *cls,
               ntohs(message->size),
               GNUNET_i2s(&(pc->identity)),http_plugin_address_to_string(NULL,ps->addr,ps->addrlen));
 #endif
+  struct GNUNET_TRANSPORT_ATS_Information distance[2];
+  distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+  distance[0].value = htonl (1);
+  distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
+  distance[1].value = htonl (0);
+
   delay = pc->plugin->env->receive (pc->plugin->env->cls,
                                                                  &pc->identity,
-                                                             message, 1, ps,
+                                                             message,
+                                                             (const struct GNUNET_TRANSPORT_ATS_Information *) &distance, 2,
+                                                             ps,
                                                              ps->addr,
                                                              ps->addrlen);
 
@@ -1589,7 +1606,7 @@ static void curl_receive_mst_cb  (void *cls,
   if (delay.rel_value > 0)
   {
 #if DEBUG_HTTP
-       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.abs_value);
+       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.rel_value);
 #endif
        pc->reset_task = GNUNET_SCHEDULER_add_delayed (delay, &reset_inbound_quota_delay, pc);
   }
@@ -2296,17 +2313,15 @@ http_plugin_send (void *cls,
       if (force_address != GNUNET_YES)
          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"No existing connection: creating new session %X to peer %s\n", ps, GNUNET_i2s(target));
 #endif
-      if ((addrlen!=0) && (addr!=NULL))
-      {
-         ps->addr = GNUNET_malloc(addrlen);
-         memcpy(ps->addr,addr,addrlen);
-         ps->addrlen = addrlen;
-      }
+         ps->addr = GNUNET_malloc(addrlen);
+         memcpy(ps->addr,addr,addrlen);
+         ps->addrlen = addrlen;
+      /*
          else
          {
                ps->addr = NULL;
                ps->addrlen = 0;
-         }
+         }*/
          ps->direction=OUTBOUND;
          ps->recv_connected = GNUNET_NO;
          ps->recv_force_disconnect = GNUNET_NO;
@@ -3099,4 +3114,4 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
   return api;
 }
 
-/* end of plugin_transport_http.c */
+/* end of gnunet_transport_plugin.http.c */