gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30915 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r30915 - gnunet/src/fs
Date: Wed, 27 Nov 2013 22:02:36 +0100

Author: grothoff
Date: 2013-11-27 22:02:36 +0100 (Wed, 27 Nov 2013)
New Revision: 30915

Modified:
   gnunet/src/fs/gnunet-service-fs_mesh_client.c
   gnunet/src/fs/gnunet-service-fs_pr.c
Log:
-attempting to address #3133

Modified: gnunet/src/fs/gnunet-service-fs_mesh_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-27 18:11:03 UTC 
(rev 30914)
+++ gnunet/src/fs/gnunet-service-fs_mesh_client.c       2013-11-27 21:02:36 UTC 
(rev 30915)
@@ -407,7 +407,7 @@
  * @param cls the 'struct HandleReplyClosure'
  * @param key the key of the entry in the map (the query)
  * @param value the 'struct GSF_MeshRequest' to handle result for
- * @return GNUNET_YES (continue to iterate)
+ * @return #GNUNET_YES (continue to iterate)
  */
 static int
 handle_reply (void *cls,
@@ -422,6 +422,7 @@
            hrc->expiration,
            hrc->data_size,
            hrc->data);
+  sr->proc = NULL;
   GSF_mesh_query_cancel (sr);
   hrc->found = GNUNET_YES;
   return GNUNET_YES;
@@ -591,7 +592,17 @@
 GSF_mesh_query_cancel (struct GSF_MeshRequest *sr)
 {
   struct MeshHandle *mh = sr->mh;
+  GSF_MeshReplyProcessor p;
 
+  p = sr->proc;
+  sr->proc = NULL;
+  if (NULL != p)
+  {
+    /* signal failure / cancellation to callback */
+    p (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY, 
+       GNUNET_TIME_UNIT_ZERO_ABS,
+       0, NULL);
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Cancelled query for %s via mesh to %s\n",
              GNUNET_h2s (&sr->query),
@@ -619,10 +630,10 @@
  * call the 'proc' continuation and release associated
  * resources.
  *
- * @param cls the 'struct MeshHandle'
+ * @param cls the `struct MeshHandle`
  * @param key the key of the entry in the map (the query)
- * @param value the 'struct GSF_MeshRequest' to clean up
- * @return GNUNET_YES (continue to iterate)
+ * @param value the `struct GSF_MeshRequest` to clean up
+ * @return #GNUNET_YES (continue to iterate)
  */
 static int
 free_waiting_entry (void *cls,
@@ -631,9 +642,6 @@
 {
   struct GSF_MeshRequest *sr = value;
 
-  sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY,
-           GNUNET_TIME_UNIT_FOREVER_ABS,
-           0, NULL);
   GSF_mesh_query_cancel (sr);
   return GNUNET_YES;
 }
@@ -660,12 +668,7 @@
   GNUNET_assert (channel == mh->channel);
   mh->channel = NULL;
   while (NULL != (sr = mh->pending_head))
-  {
-    sr->proc (sr->proc_cls, GNUNET_BLOCK_TYPE_ANY,
-             GNUNET_TIME_UNIT_FOREVER_ABS,
-             0, NULL);
     GSF_mesh_query_cancel (sr);
-  }
   GNUNET_CONTAINER_multihashmap_iterate (mh->waiting_map,
                                         &free_waiting_entry,
                                         mh);

Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c        2013-11-27 18:11:03 UTC (rev 
30914)
+++ gnunet/src/fs/gnunet-service-fs_pr.c        2013-11-27 21:02:36 UTC (rev 
30915)
@@ -595,7 +595,14 @@
   GSF_LocalLookupContinuation cont;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Cleaning up pending request for `%s'.\n", GNUNET_h2s (key));
+              "Cleaning up pending request for `%s'.\n", 
+             GNUNET_h2s (key));
+  if (NULL != pr->mesh_request)
+  {
+    pr->mesh_retry_count = MESH_RETRY_MAX;
+    GSF_mesh_query_cancel (pr->mesh_request);
+    pr->mesh_request = NULL;
+  }
   if (NULL != (cont = pr->llc_cont))
   {
     pr->llc_cont = NULL;
@@ -627,11 +634,6 @@
     GNUNET_DHT_get_stop (pr->gh);
     pr->gh = NULL;
   }
-  if (NULL != pr->mesh_request)
-  {
-    GSF_mesh_query_cancel (pr->mesh_request);
-    pr->mesh_request = NULL;
-  }
   if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task)
   {
     GNUNET_SCHEDULER_cancel (pr->warn_task);
@@ -668,6 +670,12 @@
      * but do NOT remove from our data-structures, we still need it there
      * to prevent the request from looping */
     pr->rh = NULL;
+    if (NULL != pr->mesh_request)
+    {
+      pr->mesh_retry_count = MESH_RETRY_MAX;
+      GSF_mesh_query_cancel (pr->mesh_request);
+      pr->mesh_request = NULL;
+    }
     if (NULL != (cont = pr->llc_cont))
     {
       pr->llc_cont = NULL;
@@ -684,11 +692,6 @@
       GNUNET_DHT_get_stop (pr->gh);
       pr->gh = NULL;
     }
-    if (NULL != pr->mesh_request)
-    {
-      GSF_mesh_query_cancel (pr->mesh_request);
-      pr->mesh_request = NULL;
-    }
     if (GNUNET_SCHEDULER_NO_TASK != pr->warn_task)
     {
       GNUNET_SCHEDULER_cancel (pr->warn_task);
@@ -1143,7 +1146,7 @@
  * @param cls the pending request struct
  * @param type type of the block, ANY on error
  * @param expiration expiration time for the block
- * @param data_size number of bytes in 'data', 0 on error
+ * @param data_size number of bytes in @a data, 0 on error
  * @param data reply block data, NULL on error
  */
 static void
@@ -1162,11 +1165,11 @@
   {
     GNUNET_break (NULL == data);
     GNUNET_break (0 == data_size);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-               "Error retrieiving block via mesh\n");
     pr->mesh_retry_count++;
     if (pr->mesh_retry_count >= MESH_RETRY_MAX)
       return; /* give up on mesh */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Error retrieiving block via mesh\n");
     /* retry -- without delay, as this is non-anonymous
        and mesh/mesh connect will take some time anyway */
     pr->mesh_request = GSF_mesh_query (pr->public_data.target,




reply via email to

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