gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13833 - gnunet/src/transport
Date: Tue, 30 Nov 2010 13:19:48 +0100

Author: wachs
Date: 2010-11-30 13:19:48 +0100 (Tue, 30 Nov 2010)
New Revision: 13833

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/transport.h
   gnunet/src/transport/transport_api.c
Log:
changes to transport_api


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-11-30 12:18:39 UTC 
(rev 13832)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-11-30 12:19:48 UTC 
(rev 13833)
@@ -3448,9 +3448,9 @@
   im = GNUNET_malloc (sizeof (struct InboundMessage) + ats_count * 
sizeof(struct GNUNET_TRANSPORT_ATS_Information) + msize);
   im->header.size = htons (sizeof (struct InboundMessage) +  ats_count * 
sizeof(struct GNUNET_TRANSPORT_ATS_Information) + msize);
   im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
-  im->latency = GNUNET_TIME_relative_hton (n->latency);
+  //im->latency = GNUNET_TIME_relative_hton (n->latency);
+  //im->distance = ntohl(n->distance);
   im->peer = n->id;
-  im->distance = ntohl(n->distance);
   im->ats_count = htonl(ats_count);
   /* insert ATS elements */
   memcpy (&(im->ats), ats, ats_count * sizeof(struct 
GNUNET_TRANSPORT_ATS_Information));
@@ -3680,8 +3680,14 @@
          if (NULL != (prem = n->pre_connect_message_buffer))
            {
              n->pre_connect_message_buffer = NULL;
-             /* FIXME: */
-             handle_payload_message (prem, n, NULL, 0);
+             struct GNUNET_TRANSPORT_ATS_Information * ats = GNUNET_malloc(2 * 
sizeof(struct GNUNET_TRANSPORT_ATS_Information));
+             ats[0].type = htonl(GNUNET_TRANSPORT_LATENCY_LSB);
+             ats[0].value = htonl(n->latency.rel_value);
+             ats[1].type = htonl(GNUNET_TRANSPORT_DISTANCE);
+             ats[1].value = htonl(n->distance);
+             handle_payload_message (prem, n, ats, 2);
+             fprintf(stderr,"ATS!");
+             GNUNET_free (ats);
              GNUNET_free (prem);
            }
        }
@@ -4771,6 +4777,7 @@
          handle_pong (plugin, message, peer, sender_address, 
sender_address_len);
          break;
        default:
+         /* FIXME */
          handle_payload_message (message, n, NULL, 0);
          break;
        }

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2010-11-30 12:18:39 UTC (rev 13832)
+++ gnunet/src/transport/transport.h    2010-11-30 12:19:48 UTC (rev 13833)
@@ -86,6 +86,12 @@
   struct GNUNET_MessageHeader header;
 
   /**
+   * Number of ATS key-value pairs that follow this struct
+   * (excluding the 0-terminator).
+   */
+  uint32_t ats_count GNUNET_PACKED;
+
+  /**
    * Transport distance metric (i.e. hops for DV)
    */
   uint32_t distance;
@@ -100,6 +106,11 @@
    */
   struct GNUNET_PeerIdentity id;
 
+  /**
+   * First of the ATS information blocks (we must have at least
+   * one due to the 0-termination requirement).
+   */
+  struct GNUNET_TRANSPORT_ATS_Information ats;
 };
 
 
@@ -198,7 +209,7 @@
   /**
    * Latency estimate.
    */
-  struct GNUNET_TIME_RelativeNBO latency;
+  //struct GNUNET_TIME_RelativeNBO latency;
 
   /**
    * Which peer sent the message?
@@ -208,7 +219,7 @@
   /**
    * Distance metric.
    */
-  uint32_t distance;
+  //uint32_t distance;
 
   /**
    * First of the ATS information blocks (we must have at least

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2010-11-30 12:18:39 UTC (rev 
13832)
+++ gnunet/src/transport/transport_api.c        2010-11-30 12:19:48 UTC (rev 
13833)
@@ -1591,9 +1591,12 @@
       GNUNET_break (n->is_connected == GNUNET_NO);
       n->is_connected = GNUNET_YES;
       if (h->nc_cb != NULL)
+         h->nc_cb (h->cls, &n->id, &(cim->ats), cim->ats_count);
+/*
        h->nc_cb (h->cls, &n->id,
                  GNUNET_TIME_relative_ntoh (cim->latency),
                  ntohl (cim->distance));
+*/
       break;
     case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT:
       if (size != sizeof (struct DisconnectInfoMessage))
@@ -1685,8 +1688,8 @@
          break;
        }
       if (h->rec != NULL)
-       h->rec (h->cls, &im->peer, imm,
-               GNUNET_TIME_relative_ntoh (im->latency), ntohl(im->distance));
+         h->rec (h->cls, &im->peer, imm, &im->ats, im->ats_count);
+        //h->rec (h->cls, &im->peer, imm, GNUNET_TIME_relative_ntoh 
(im->latency), ntohl(im->distance));
       break;
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,




reply via email to

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