gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10351 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r10351 - gnunet/src/core
Date: Wed, 17 Feb 2010 17:32:11 +0100

Author: grothoff
Date: 2010-02-17 17:32:11 +0100 (Wed, 17 Feb 2010)
New Revision: 10351

Modified:
   gnunet/src/core/core.h
   gnunet/src/core/core_api_peer_request.c
   gnunet/src/core/gnunet-service-core.c
Log:
timeout

Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h      2010-02-17 14:42:56 UTC (rev 10350)
+++ gnunet/src/core/core.h      2010-02-17 16:32:11 UTC (rev 10351)
@@ -29,7 +29,7 @@
 /**
  * General core debugging.
  */
-#define DEBUG_CORE GNUNET_NO
+#define DEBUG_CORE GNUNET_YES
 
 /**
  * Debugging interaction core-clients.
@@ -329,6 +329,11 @@
   uint32_t reserved GNUNET_PACKED;
 
   /**
+   * When to time out.
+   */
+  struct GNUNET_TIME_RelativeNBO timeout;
+
+  /**
    * Identity of the other peer.
    */
   struct GNUNET_PeerIdentity peer;

Modified: gnunet/src/core/core_api_peer_request.c
===================================================================
--- gnunet/src/core/core_api_peer_request.c     2010-02-17 14:42:56 UTC (rev 
10350)
+++ gnunet/src/core/core_api_peer_request.c     2010-02-17 16:32:11 UTC (rev 
10351)
@@ -57,6 +57,11 @@
   void *cont_cls;
 
   /**
+   * When to time out.
+   */
+  struct GNUNET_TIME_Absolute timeout;
+
+  /**
    * Identity of the peer to connect to.
    */
   struct GNUNET_PeerIdentity peer;
@@ -98,6 +103,7 @@
   msg.header.type = htons (prh->type);
   msg.header.size = htons (sizeof (struct ConnectMessage));
   msg.reserved = htonl (0);
+  msg.timeout = GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining 
(prh->timeout));
   msg.peer = prh->peer;
   memcpy (buf, &msg, sizeof (msg));
   GNUNET_SCHEDULER_add_continuation (prh->sched,
@@ -149,6 +155,7 @@
   ret->cont_cls = cont_cls;
   ret->peer = *peer;
   ret->type = GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT;
+  ret->timeout = GNUNET_TIME_relative_to_absolute (timeout);
   GNUNET_CLIENT_notify_transmit_ready (client,
                                       sizeof (struct ConnectMessage),
                                       timeout,

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-02-17 14:42:56 UTC (rev 
10350)
+++ gnunet/src/core/gnunet-service-core.c       2010-02-17 16:32:11 UTC (rev 
10351)
@@ -2045,8 +2045,13 @@
 notify_transport_connect_done (void *cls, size_t size, void *buf)
 {
   struct Neighbour *n = cls;
+  struct GNUNET_MessageHeader hdr;
+
   n->th = NULL;
-  return 0;
+  hdr.type = htons (GNUNET_MESSAGE_TYPE_TOPOLOGY_DUMMY);
+  hdr.size = htons (sizeof(hdr));
+  memcpy (buf, &hdr, sizeof (hdr));
+  return sizeof (hdr);
 }
 
 
@@ -2064,6 +2069,7 @@
 {
   const struct ConnectMessage *cm = (const struct ConnectMessage*) message;
   struct Neighbour *n;
+  struct GNUNET_TIME_Relative timeout;
 
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
   n = find_neighbour (&cm->peer);
@@ -2078,12 +2084,12 @@
              "REQUEST_CONNECT",
              GNUNET_i2s (&cm->peer));
 #endif
+  timeout = GNUNET_TIME_relative_ntoh (cm->timeout);
   /* ask transport to connect to the peer */
-  /* FIXME: timeout zero OK? */
   n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport,
                                                  &cm->peer,
-                                                 0, 0,
-                                                 GNUNET_TIME_UNIT_ZERO,
+                                                 sizeof (struct 
GNUNET_MessageHeader), 0,
+                                                 timeout,
                                                  
&notify_transport_connect_done,
                                                  n);
   GNUNET_break (NULL != n->th);





reply via email to

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