gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26537 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r26537 - gnunet/src/transport
Date: Thu, 21 Mar 2013 14:30:51 +0100

Author: wachs
Date: 2013-03-21 14:30:51 +0100 (Thu, 21 Mar 2013)
New Revision: 26537

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_manipulation.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/gnunet-service-transport_neighbours.h
   gnunet/src/transport/gnunet-transport.c
   gnunet/src/transport/transport-testing.c
   gnunet/src/transport/transport.h
   gnunet/src/transport/transport_api.c
Log:
ats related changes in transport


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2013-03-21 12:46:12 UTC 
(rev 26536)
+++ gnunet/src/transport/gnunet-service-transport.c     2013-03-21 13:30:51 UTC 
(rev 26537)
@@ -154,18 +154,15 @@
 process_payload (const struct GNUNET_PeerIdentity *peer,
                  const struct GNUNET_HELLO_Address *address,
                  struct Session *session,
-                 const struct GNUNET_MessageHeader *message,
-                 const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
+                 const struct GNUNET_MessageHeader *message)
 {
   struct GNUNET_TIME_Relative ret;
   int do_forward;
   struct InboundMessage *im;
   size_t msg_size = ntohs (message->size);
   size_t size =
-      sizeof (struct InboundMessage) + msg_size +
-      sizeof (struct GNUNET_ATS_Information) * (ats_count + 1);
+      sizeof (struct InboundMessage) + msg_size;
   char buf[size] GNUNET_ALIGN;
-  struct GNUNET_ATS_Information *ap;
 
   ret = GNUNET_TIME_UNIT_ZERO;
   do_forward = GNUNET_SYSERR;
@@ -190,17 +187,17 @@
   im = (struct InboundMessage *) buf;
   im->header.size = htons (size);
   im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
-  im->ats_count = htonl (ats_count + 1);
   im->peer = *peer;
-  ap = (struct GNUNET_ATS_Information *) &im[1];
-  memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information));
+
+  fprintf (stderr, "FIX THIS: %s:%u \n", __FILE__, __LINE__);
+  /*
   ap[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
   ap[ats_count].value =
-      htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);
-  memcpy (&ap[ats_count + 1], message, ntohs (message->size));
+      htonl ((uint32_t) GST_neighbour_get_latency (peer).rel_value);*/
+  memcpy (&im[1], message, ntohs (message->size));
 
-  GNUNET_ATS_address_add (GST_ats, address, session, ap, ats_count + 1);
-  GNUNET_ATS_address_update (GST_ats, address, session, ap, ats_count + 1);
+  GNUNET_ATS_address_add (GST_ats, address, session, NULL, 0);
+  GNUNET_ATS_address_update (GST_ats, address, session, NULL, 0);
   GST_clients_broadcast (&im->header, GNUNET_YES);
 
   return ret;
@@ -280,10 +277,10 @@
     GST_neighbours_handle_connect (message, peer, &address, session);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK:
-    GST_neighbours_handle_connect_ack (message, peer, &address, session, NULL, 
0);
+    GST_neighbours_handle_connect_ack (message, peer, &address, session);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK:
-    GST_neighbours_handle_session_ack (message, peer, &address, session, NULL, 
0);
+    GST_neighbours_handle_session_ack (message, peer, &address, session);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
     GST_neighbours_handle_disconnect_message (peer, message);
@@ -292,7 +289,7 @@
     GST_neighbours_keepalive (peer);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE:
-    GST_neighbours_keepalive_response (peer, NULL, 0);
+    GST_neighbours_keepalive_response (peer);
     break;
   default:
     /* should be payload */
@@ -300,7 +297,7 @@
                               gettext_noop
                               ("# bytes payload received"),
                               ntohs (message->size), GNUNET_NO);
-    ret = process_payload (peer, &address, session, message, NULL, 0);
+    ret = process_payload (peer, &address, session, message);
     break;
   }
 end:

Modified: gnunet/src/transport/gnunet-service-transport_manipulation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_manipulation.c        
2013-03-21 12:46:12 UTC (rev 26536)
+++ gnunet/src/transport/gnunet-service-transport_manipulation.c        
2013-03-21 13:30:51 UTC (rev 26537)
@@ -370,6 +370,7 @@
        uint32_t m_distance;
        int d;
 
+
        m_distance = 0;
        if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, 
&peer->hashPubKey)))
        {

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-03-21 
12:46:12 UTC (rev 26536)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-03-21 
13:30:51 UTC (rev 26537)
@@ -1505,17 +1505,13 @@
  * plus calculated latency) to ATS.
  *
  * @param neighbour neighbour to keep alive
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 void
-GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
-                                   const struct GNUNET_ATS_Information *ats,
-                                   uint32_t ats_count)
+GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour)
 {
   struct NeighbourMapEntry *n;
   uint32_t latency;
-  struct GNUNET_ATS_Information ats_new[ats_count + 1];
+  struct GNUNET_ATS_Information ats;
 
   if (NULL == (n = lookup_neighbour (neighbour)))
   {
@@ -1540,18 +1536,17 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Latency for peer `%s' is %llu ms\n",
               GNUNET_i2s (&n->id), n->latency.rel_value);
-  memcpy (ats_new, ats, sizeof (struct GNUNET_ATS_Information) * ats_count);
   /* append latency */
-  ats_new[ats_count].type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
+  ats.type = htonl (GNUNET_ATS_QUALITY_NET_DELAY);
   if (n->latency.rel_value > UINT32_MAX)
     latency = UINT32_MAX;
   else
     latency = n->latency.rel_value;
-  ats_new[ats_count].value = htonl (latency);
+  ats.value = htonl (latency);
+  fprintf (stderr, "FIX THIS: %s %u \n", __FILE__, __LINE__);
   GNUNET_ATS_address_update (GST_ats, 
                             n->primary_address.address, 
-                            n->primary_address.session, ats_new,
-                            ats_count + 1);
+                            n->primary_address.session, &ats, 1);
 }
 
 
@@ -2757,9 +2752,7 @@
 GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
                                    const struct GNUNET_PeerIdentity *peer,
                                    const struct GNUNET_HELLO_Address *address,
-                                   struct Session *session,
-                                   const struct GNUNET_ATS_Information *ats,
-                                   uint32_t ats_count)
+                                   struct Session *session)
 {
   const struct SessionConnectMessage *scm;
   struct GNUNET_TIME_Absolute ts;
@@ -2807,14 +2800,14 @@
                           gettext_noop ("# peers connected"), 
                           ++neighbours_connected,
                           GNUNET_NO);
-    connect_notify_cb (callback_cls, &n->id, ats, ats_count,
+    connect_notify_cb (callback_cls, &n->id, NULL, 0,
                        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,
-                            ats, ats_count);
+                            NULL, 0);
     set_address (&n->primary_address,
                 n->primary_address.address,
                 n->primary_address.session,
@@ -2862,7 +2855,7 @@
     GNUNET_ATS_address_add(GST_ats,
                            n->alternative_address.address,
                            n->alternative_address.session,
-                           ats, ats_count);
+                           NULL, 0);
     set_address (&n->primary_address,
                 n->alternative_address.address,
                 n->alternative_address.session,
@@ -3030,16 +3023,12 @@
  * @param address address of the other peer, NULL if other peer
  *                       connected to us
  * @param session session to use (or NULL)
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 void
 GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
                                   const struct GNUNET_PeerIdentity *peer,
                                   const struct GNUNET_HELLO_Address *address,
-                                  struct Session *session,
-                                  const struct GNUNET_ATS_Information *ats,
-                                  uint32_t ats_count)
+                                  struct Session *session)
 {
   struct NeighbourMapEntry *n;
 
@@ -3070,13 +3059,13 @@
                         gettext_noop ("# peers connected"), 
                         ++neighbours_connected,
                         GNUNET_NO);
-  connect_notify_cb (callback_cls, &n->id, ats, ats_count,
+  connect_notify_cb (callback_cls, &n->id, NULL, 0,
                      n->primary_address.bandwidth_in,
                      n->primary_address.bandwidth_out);
   GNUNET_ATS_address_add(GST_ats,
                          n->primary_address.address,
                          n->primary_address.session,
-                         ats, ats_count);
+                         NULL, 0);
   set_address (&n->primary_address,
               n->primary_address.address,
               n->primary_address.session,

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.h  2013-03-21 
12:46:12 UTC (rev 26536)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.h  2013-03-21 
13:30:51 UTC (rev 26537)
@@ -138,13 +138,9 @@
  * to this peer
  *
  * @param neighbour neighbour to keep alive
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 void
-GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
-                                   const struct GNUNET_ATS_Information *ats,
-                                   uint32_t ats_count);
+GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity 
*neighbour);
 
 
 /**
@@ -244,9 +240,7 @@
  * @param address address of the other peer, NULL if other peer
  *                       connected to us
  * @param session session to use (or NULL)
- * @param ats performance data
- * @param ats_count number of entries in ats (excluding 0-termination)
-  */
+ */
 void
 GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
                                const struct GNUNET_PeerIdentity *peer,
@@ -263,16 +257,12 @@
  * @param address address of the other peer, NULL if other peer
  *                       connected to us
  * @param session session to use (or NULL)
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 void
 GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
                                    const struct GNUNET_PeerIdentity *peer,
                                    const struct GNUNET_HELLO_Address *address,
-                                   struct Session *session,
-                                   const struct GNUNET_ATS_Information *ats,
-                                   uint32_t ats_count);
+                                   struct Session *session);
 
 
 /**
@@ -284,16 +274,12 @@
  * @param address address of the other peer, NULL if other peer
  *                       connected to us
  * @param session session to use (or NULL)
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 void
 GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
                                   const struct GNUNET_PeerIdentity *peer,
                                   const struct GNUNET_HELLO_Address *address,
-                                  struct Session *session,
-                                  const struct GNUNET_ATS_Information *ats,
-                                  uint32_t ats_count);
+                                  struct Session *session);
 
 
 /**

Modified: gnunet/src/transport/gnunet-transport.c
===================================================================
--- gnunet/src/transport/gnunet-transport.c     2013-03-21 12:46:12 UTC (rev 
26536)
+++ gnunet/src/transport/gnunet-transport.c     2013-03-21 13:30:51 UTC (rev 
26537)
@@ -648,13 +648,10 @@
  * @param cls closure
  * @param peer (claimed) identity of the other peer
  * @param message the message
- * @param ats performance data
- * @param ats_count number of entries in ats
  */
 static void
 notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message,
-                const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
+                const struct GNUNET_MessageHeader *message)
 {
   if (benchmark_receive)
   {

Modified: gnunet/src/transport/transport-testing.c
===================================================================
--- gnunet/src/transport/transport-testing.c    2013-03-21 12:46:12 UTC (rev 
26536)
+++ gnunet/src/transport/transport-testing.c    2013-03-21 13:30:51 UTC (rev 
26537)
@@ -145,15 +145,14 @@
 
 static void
 notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_MessageHeader *message,
-                const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
+                const struct GNUNET_MessageHeader *message)
 {
   struct PeerContext *p = cls;
 
   if (p == NULL)
     return;
   if (p->rec != NULL)
-    p->rec (p->cb_cls, peer, message, ats, ats_count);
+    p->rec (p->cb_cls, peer, message);
 }
 
 

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2013-03-21 12:46:12 UTC (rev 26536)
+++ gnunet/src/transport/transport.h    2013-03-21 13:30:51 UTC (rev 26537)
@@ -235,12 +235,6 @@
   struct GNUNET_MessageHeader header;
 
   /**
-   * Number of ATS key-value pairs that follow this struct
-   * (excluding the 0-terminator).
-   */
-  uint32_t ats_count GNUNET_PACKED;
-
-  /**
    * Which peer sent the message?
    */
   struct GNUNET_PeerIdentity peer;

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2013-03-21 12:46:12 UTC (rev 
26536)
+++ gnunet/src/transport/transport_api.c        2013-03-21 13:30:51 UTC (rev 
26537)
@@ -619,11 +619,8 @@
       break;
     }
     im = (const struct InboundMessage *) msg;
-    ats_count = ntohl (im->ats_count);
-    ats = (const struct GNUNET_ATS_Information *) &im[1];
-    imm = (const struct GNUNET_MessageHeader *) &ats[ats_count];
-    if (ntohs (imm->size) + sizeof (struct InboundMessage) +
-        ats_count * sizeof (struct GNUNET_ATS_Information) != size)
+    imm = (const struct GNUNET_MessageHeader *) &im[1];
+    if (ntohs (imm->size) + sizeof (struct InboundMessage) != size)
     {
       GNUNET_break (0);
       break;
@@ -637,7 +634,7 @@
       break;
     }
     if (h->rec != NULL)
-      h->rec (h->cls, &im->peer, imm, ats, ats_count);
+      h->rec (h->cls, &im->peer, imm);
     break;
   case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA:
     LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "SET_QUOTA");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]