gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r10088 - gnunet/src/transport
Date: Thu, 21 Jan 2010 15:07:41 +0100

Author: nevans
Date: 2010-01-21 15:07:41 +0100 (Thu, 21 Jan 2010)
New Revision: 10088

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/transport.h
   gnunet/src/transport/transport_api.c
Log:
it compiles, but definitely doesn't work

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-01-21 14:06:06 UTC (rev 
10087)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-01-21 14:07:41 UTC (rev 
10088)
@@ -513,10 +513,11 @@
          know about this one, so we need to 
          notify transport service about disconnect */
       session->plugin->env->receive (session->plugin->env->cls,
-                                    1,
+                                     NULL,
+                                     &session->target,
+                                     1,
                                     session->connect_addr,
-                                    session->connect_alen,
-                                     &session->target, NULL);
+                                    session->connect_alen);
     }
   if (session->client != NULL)
     {
@@ -1089,10 +1090,9 @@
                   (unsigned int) msize,
                    (unsigned int) ntohs (msg->type));
 #endif
-  plugin->env->receive (plugin->env->cls, 1,
+  plugin->env->receive (plugin->env->cls, message, &session->target, 1,
                        session->connect_addr,
-                       session->connect_alen,
-                       &session->target, message);
+                       session->connect_alen);
   /* update bandwidth used */
   session->last_received += msize;
   update_quota (session, GNUNET_NO);

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2010-01-21 14:06:06 UTC (rev 
10087)
+++ gnunet/src/transport/plugin_transport_udp.c 2010-01-21 14:07:41 UTC (rev 
10088)
@@ -330,10 +330,9 @@
                        ("msg reports message type of %d\n"),
                        ntohs (hdr->type));
 #endif
+      plugin->env->receive (plugin->env->cls,
+          &msg->header, sender, UDP_DIRECT_DISTANCE, (char *)&addr, fromlen);
 
-      plugin->env->receive (plugin->env->cls, UDP_DIRECT_DISTANCE,(char 
*)&addr, fromlen, sender,
-                              &msg->header);
-
       GNUNET_free (sender);
       GNUNET_free (buf);
 

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2010-01-21 14:06:06 UTC (rev 10087)
+++ gnunet/src/transport/transport.h    2010-01-21 14:07:41 UTC (rev 10088)
@@ -64,6 +64,11 @@
    */
   struct GNUNET_TIME_RelativeNBO latency;
 
+  /*
+   * Transport distance metric (i.e. hops for DV)
+   */
+  uint16_t distance;
+
   /**
    * Identity of the new neighbour.
    */
@@ -175,6 +180,11 @@
    */
   struct GNUNET_PeerIdentity peer;
 
+  /*
+   * Distance metric.
+   */
+  uint16_t distance;
+
 };
 
 

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2010-01-21 14:06:06 UTC (rev 
10087)
+++ gnunet/src/transport/transport_api.c        2010-01-21 14:07:41 UTC (rev 
10088)
@@ -138,7 +138,7 @@
   /**
    * Callback to call once we got our HELLO.
    */
-  GNUNET_TRANSPORT_ReceiveCallback rec;
+  GNUNET_TRANSPORT_HelloUpdateCallback rec;
 
   /**
    * Closure for rec.
@@ -818,7 +818,7 @@
   else
     prev->next = hwl->next;
   if (hwl->rec != NULL)
-    hwl->rec (hwl->rec_cls, GNUNET_TIME_UNIT_ZERO, NULL, NULL);
+    hwl->rec (hwl->rec_cls, NULL);
   GNUNET_free (hwl);
 }
 
@@ -836,8 +836,7 @@
  */
 void
 GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle,
-                            struct GNUNET_TIME_Relative timeout,
-                            GNUNET_TRANSPORT_ReceiveCallback rec,
+                            GNUNET_TRANSPORT_HelloUpdateCallback rec,
                             void *rec_cls)
 {
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
@@ -852,10 +851,14 @@
       hwl->handle = handle;
       hwl->rec = rec;
       hwl->rec_cls = rec_cls;
-      hwl->timeout = GNUNET_TIME_relative_to_absolute (timeout);
+      /* hwl->timeout = GNUNET_TIME_relative_to_absolute (timeout);
+       * Timeout not needed, because we should notify on change.
+       * FIXME: set up scheduler to notify on modification?
+
       hwl->task = GNUNET_SCHEDULER_add_delayed (handle->sched,
                                                 timeout,
                                                 &hello_wait_timeout, hwl);
+      */
       return;
     }
   GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_key (handle->my_hello, &pk));
@@ -863,9 +866,7 @@
                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
                       &me.hashPubKey);
 
-  rec (rec_cls,
-       GNUNET_TIME_UNIT_ZERO,
-       &me, (const struct GNUNET_MessageHeader *) handle->my_hello);
+  rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello);
 }
 
 
@@ -1342,6 +1343,7 @@
 add_neighbour (struct GNUNET_TRANSPORT_Handle *h,
                uint32_t quota_out,
                struct GNUNET_TIME_Relative latency,
+               uint16_t distance,
                const struct GNUNET_PeerIdentity *pid)
 {
   struct NeighbourList *n;
@@ -1367,7 +1369,7 @@
   n->transmit_ok = GNUNET_YES;
   h->neighbours = n;
   if (h->nc_cb != NULL)
-    h->nc_cb (h->cls, &n->id, latency);
+    h->nc_cb (h->cls, &n->id, latency, distance);
   prev = NULL;
   pos = h->connect_wait_head;
   while (pos != NULL)
@@ -1512,7 +1514,7 @@
                   ("Disconnect while trying to obtain `%s' from transport 
service.\n"),
                   "HELLO");
       if (hwl->rec != NULL)
-        hwl->rec (hwl->rec_cls, GNUNET_TIME_UNIT_ZERO, NULL, NULL);
+        hwl->rec (hwl->rec_cls, NULL);
       GNUNET_free (hwl);
     }
   if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1631,7 +1633,6 @@
           h->hwl_head = hwl->next;
           GNUNET_SCHEDULER_cancel (h->sched, hwl->task);
           GNUNET_TRANSPORT_get_hello (h,
-                                      GNUNET_TIME_UNIT_ZERO,
                                       hwl->rec, hwl->rec_cls);
           GNUNET_free (hwl);
         }
@@ -1650,7 +1651,7 @@
 #endif
       add_neighbour (h,
                      ntohl (cim->quota_out),
-                     GNUNET_TIME_relative_ntoh (cim->latency), &cim->id);
+                     GNUNET_TIME_relative_ntoh (cim->latency), 
ntohs(cim->distance), &cim->id);
       break;
     case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT:
       if (size != sizeof (struct DisconnectInfoMessage))
@@ -1748,8 +1749,8 @@
                       ntohs (imm->type), GNUNET_i2s (&im->peer));
 #endif
           if (h->rec != NULL)
-            h->rec (h->cls,
-                    GNUNET_TIME_relative_ntoh (im->latency), &im->peer, imm);
+            h->rec (h->cls, &im->peer, imm,
+                    GNUNET_TIME_relative_ntoh (im->latency), 
ntohs(im->distance));
           break;
         }
       break;





reply via email to

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