doxygen
[oweals/gnunet.git] / src / transport / plugin_transport_http.c
index fa4cf9d9c142cc5bbb9fd92dce46d1e410345c89..f879012c92b25ec74c45f489e6dfb57f8e9a0a64 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file transport/gnunet_transport_plugin.http.c
+ * @file transport/plugin_transport_http.c
  * @brief http transport service plugin
  * @author Matthias Wachs
  */
@@ -512,18 +512,18 @@ static void http_server_daemon_v6_run (void *cls, const struct GNUNET_SCHEDULER_
 
 /**
  * Function setting up curl handle and selecting message to send
+ *
  * @param plugin plugin
- * @param ses session to send data to
- * @param con connection
- * @return bytes sent to peer
+ * @param ps session
+ * @return GNUNET_SYSERR on failure, GNUNET_NO if connecting, GNUNET_YES if ok
  */
 static int send_check_connections (struct Plugin *plugin, struct Session *ps);
 
 /**
  * Function setting up file descriptors and scheduling task to run
- * @param cls closure
- * @param ses session to send data to
- * @param
+ *
+ * @param  plugin plugin as closure
+ * @return GNUNET_SYSERR for hard failure, GNUNET_OK for ok
  */
 static int curl_schedule (struct Plugin *plugin);
 
@@ -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);
 
@@ -1801,7 +1818,7 @@ static void curl_perform (void *cls,
 /**
  * Function setting up file descriptors and scheduling task to run
  *
- * @param plugin plugin as closure
+ * @param  plugin plugin as closure
  * @return GNUNET_SYSERR for hard failure, GNUNET_OK for ok
  */
 static int curl_schedule(struct Plugin *plugin)
@@ -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;