gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17504 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r17504 - gnunet/src/mesh
Date: Fri, 14 Oct 2011 18:23:32 +0200

Author: bartpolot
Date: 2011-10-14 18:23:32 +0200 (Fri, 14 Oct 2011)
New Revision: 17504

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
Log:
WiP

Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-10-14 16:16:34 UTC (rev 
17503)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-10-14 16:23:32 UTC (rev 
17504)
@@ -66,6 +66,10 @@
                                     GNUNET_TIME_UNIT_SECONDS,\
                                     5)
 
+#define UNACKNOWLEDGED_WAIT     GNUNET_TIME_relative_multiply(\
+                                    GNUNET_TIME_UNIT_SECONDS,\
+                                    2)
+
 
/******************************************************************************/
 /************************      DATA STRUCTURES     
****************************/
 
/******************************************************************************/
@@ -103,6 +107,9 @@
     /** Size of the data */
   size_t size;
 
+    /** Used to allow a client send more traffic to the service after a
+     * previous packet was tried to be sent to a neighbor and couldn't */
+  GNUNET_SCHEDULER_TaskIdentifier timeout_task;
 };
 
 
@@ -674,7 +681,18 @@
   return GNUNET_CONTAINER_multihashmap_contains (c->types, &hc);
 }
 
+static void
+client_allow_send(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct MeshDataDescriptor *info = cls;
 
+  if (GNUNET_SCHEDULER_REASON_SHUTDOWN == tc->reason)
+    return;
+  info->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+  GNUNET_SERVER_receive_done(info->client, GNUNET_OK);
+}
+
+
 /**
  * Search for a tunnel by global ID using full PeerIdentities
  *
@@ -2279,6 +2297,9 @@
     info->size = size;
     info->copies = copies;
     info->client = t->client->handle;
+    info->timeout_task = GNUNET_SCHEDULER_add_delayed(UNACKNOWLEDGED_WAIT,
+                                                      &client_allow_send,
+                                                      t->client->handle);
     info->destination = n->peer;
     id = path_get_first_hop(t->tree, n->peer);
     info->peer = peer_info_get(id);




reply via email to

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