adapt to new API
authorChristian Grothoff <christian@grothoff.org>
Fri, 25 Mar 2011 08:49:47 +0000 (08:49 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 25 Mar 2011 08:49:47 +0000 (08:49 +0000)
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_lc.c
src/fs/gnunet-service-fs_pr.c
src/fs/gnunet-service-fs_pr.h
src/fs/gnunet-service-fs_push.c
src/fs/gnunet-service-fs_put.c

index ab16bc8343da4ac33c974cd0ac5e2f2bf1c448f6..687f131d1bacf416b02bb3aafba0f7ed310a0bcc 100644 (file)
@@ -1297,7 +1297,7 @@ process_migration_content (void *cls,
       MIN_MIGRATION_CONTENT_LIFETIME.rel_value)
     {
       /* content will expire soon, don't bother */
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+      GNUNET_DATASTORE_get_next (dsh);
       return;
     }
   if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
@@ -1309,7 +1309,7 @@ process_migration_content (void *cls,
                                            &process_migration_content,
                                            NULL))
        {
-         GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+         GNUNET_DATASTORE_get_next (dsh);
        }
       return;
     }
@@ -1333,7 +1333,7 @@ process_migration_content (void *cls,
   GNUNET_CONTAINER_multihashmap_iterate (connected_peers,
                                         &consider_migration,
                                         mb);
-  GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (dsh);
 }
 
 
@@ -1344,7 +1344,7 @@ static void
 dht_put_continuation (void *cls,
                      const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (dsh);
 }
 
 
@@ -3984,7 +3984,7 @@ process_local_reply (void *cls,
                                            pr))
       if (pr->qe != NULL)
        {
-         GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+         GNUNET_DATASTORE_get_next (dsh);
        }
       return;
     }
@@ -4007,7 +4007,7 @@ process_local_reply (void *cls,
                               -1, -1, 
                               GNUNET_TIME_UNIT_FOREVER_REL,
                               NULL, NULL);
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+      GNUNET_DATASTORE_get_next (dsh);
       return;
     }
   prq.type = type;
@@ -4026,7 +4026,7 @@ process_local_reply (void *cls,
   if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST)
     {
       pr->local_only = GNUNET_YES; /* do not forward */
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
+      GNUNET_DATASTORE_get_next (dsh);
       return;
     }
   if ( (pr->client_request_list == NULL) &&
@@ -4041,10 +4041,10 @@ process_local_reply (void *cls,
                                gettext_noop ("# processing result set cut short due to load"),
                                1,
                                GNUNET_NO);
-      GNUNET_DATASTORE_get_next (dsh, GNUNET_NO);
+      GNUNET_DATASTORE_get_next (dsh);
       return;
     }
-  GNUNET_DATASTORE_get_next (dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (dsh);
 }
 
 
index c4e82350f5c90114c9af3c5e77dbe6ba9dccefd0..9ff96ba367206606163d841404ebae8d701c34a0 100644 (file)
@@ -562,17 +562,13 @@ copy_reply (void *cls,
  * @param expiration when does 'data' expire?
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
- * @param more GNUNET_YES if the request remains active (may call
- *             this function again), GNUNET_NO if the request is
- *             finished (client must not call GSF_pending_request_cancel_)
  */
 static void
 handle_p2p_reply (void *cls,
                  struct GSF_PendingRequest *pr,
                  struct GNUNET_TIME_Absolute expiration,
                  const void *data,
-                 size_t data_len,
-                 int more)
+                 size_t data_len)
 {
   struct GSF_ConnectedPeer *cp = cls;
   struct GSF_PendingRequestData *prd;
@@ -582,7 +578,6 @@ handle_p2p_reply (void *cls,
   prd = GSF_pending_request_get_data_ (pr);
   if (NULL == data)
     {
-      GNUNET_assert (GNUNET_NO == more);
       GNUNET_STATISTICS_update (GSF_stats,
                                gettext_noop ("# P2P searches active"),
                                -1,
index 8727670e8d9fb4e66824323f8453199406cfc8d1..5ceb7c2a5fbc85022897146bd331945b0fe9a348 100644 (file)
@@ -192,17 +192,13 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
  * @param expiration when does 'data' expire?
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
- * @param more GNUNET_YES if the request remains active (may call
- *             this function again), GNUNET_NO if the request is
- *             finished (client must not call GSF_pending_request_cancel_)
  */
 static void
 client_response_handler (void *cls,
                         struct GSF_PendingRequest *pr,
                         struct GNUNET_TIME_Absolute expiration,
                         const void *data,
-                        size_t data_len,
-                        int more)
+                        size_t data_len)
 {
   struct ClientRequest *cr = cls;
   struct GSF_LocalClient *lc;
@@ -214,7 +210,6 @@ client_response_handler (void *cls,
     {
       /* ugh, request 'timed out' -- how can this be? */
       GNUNET_break (0);
-      GNUNET_assert (GNUNET_NO == more);
       return;
     }
   GNUNET_STATISTICS_update (GSF_stats,
@@ -238,19 +233,6 @@ client_response_handler (void *cls,
              GNUNET_h2s (&prd->query),
              (unsigned int) prd->type);
 #endif
-  if (GNUNET_NO == more)               
-    {
-      GNUNET_CONTAINER_DLL_remove (lc->cr_head,
-                                  lc->cr_tail,
-                                  cr);
-      GNUNET_SERVER_receive_done (lc->client,
-                                 GNUNET_OK);
-      GNUNET_STATISTICS_update (GSF_stats,
-                               gettext_noop ("# client searches active"),
-                               - 1,
-                               GNUNET_NO);
-      GNUNET_free (cr);
-    }
 }
 
 
index c3116ba23e6b1c6f48b213babb37a65011017b34..13de31c7c6074477d88dbc322f0fd1e4667f9e36 100644 (file)
@@ -333,8 +333,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
          dpr->rh (dpr->rh_cls,
                   dpr,
                   GNUNET_TIME_UNIT_FOREVER_ABS,
-                  NULL, 0,
-                  GNUNET_SYSERR);
+                  NULL, 0);
          GSF_pending_request_cancel_ (dpr);
        }
     }
@@ -617,11 +616,6 @@ struct ProcessReplyClosure
    */
   enum GNUNET_BLOCK_EvaluationResult eval;
 
-  /**
-   * Did we finish processing the associated request?
-   */ 
-  int finished;
-
   /**
    * Did we find a matching request?
    */
@@ -698,11 +692,7 @@ process_reply (void *cls,
       pr->rh (pr->rh_cls,            
              pr,
              prq->expiration,
-             prq->data, prq->size, 
-             GNUNET_NO);
-      /* destroy request, we're done */
-      prq->finished = GNUNET_YES;
-      GSF_pending_request_cancel_ (pr);
+             prq->data, prq->size);
       return GNUNET_YES;
     case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
       GNUNET_STATISTICS_update (GSF_stats,
@@ -759,8 +749,7 @@ process_reply (void *cls,
   pr->rh (pr->rh_cls,
          pr, 
          prq->expiration,
-         prq->data, prq->size, 
-         GNUNET_YES);
+         prq->data, prq->size);
   return GNUNET_YES;
 }
 
@@ -958,13 +947,16 @@ process_local_reply (void *cls,
 {
   struct GSF_PendingRequest *pr = cls;
   GSF_LocalLookupContinuation cont;
-
   struct ProcessReplyClosure prq;
   GNUNET_HashCode query;
   unsigned int old_rf;
   
   if (NULL == key)
     {
+#if DEBUG_FS
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "No further local repsonses available.\n");
+#endif
       pr->qe = NULL;
       if (NULL != (cont = pr->llc_cont))
        {
@@ -998,7 +990,7 @@ process_local_reply (void *cls,
                                            pr))
        {
          if (pr->qe != NULL)
-           GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);        
+           GNUNET_DATASTORE_get_next (GSF_dsh);
        }
       return;
     }
@@ -1021,26 +1013,17 @@ process_local_reply (void *cls,
                               -1, -1, 
                               GNUNET_TIME_UNIT_FOREVER_REL,
                               NULL, NULL);
-      GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+      GNUNET_DATASTORE_get_next (GSF_dsh);
       return;
     }
   prq.type = type;
   prq.priority = priority;  
-  prq.finished = GNUNET_NO;
   prq.request_found = GNUNET_NO;
   prq.anonymity_level = anonymity;
   if ( (old_rf == 0) &&
        (pr->public_data.results_found == 0) )
     GSF_update_datastore_delay_ (pr->public_data.start_time);
   process_reply (&prq, key, pr);
-  if (prq.finished == GNUNET_YES)
-    {
-#if DEBUG_FS
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Request processing finished, not asking datastore for more\n");
-#endif
-      return;
-    }
   pr->local_result = prq.eval;
   if (pr->qe == NULL)
     {
@@ -1049,11 +1032,6 @@ process_local_reply (void *cls,
                  "Request cancelled, not asking datastore for more\n");
 #endif
     }
-  if (prq.eval == GNUNET_BLOCK_EVALUATION_OK_LAST)
-    {
-      GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO);
-      return;
-    }
   if ( (0 == (GSF_PRO_PRIORITY_UNLIMITED & pr->public_data.options)) &&
        ( (GNUNET_YES == GSF_test_get_load_too_high_ (0)) ||
         (pr->public_data.results_found > 5 + 2 * pr->public_data.priority) ) )
@@ -1066,10 +1044,18 @@ process_local_reply (void *cls,
                                gettext_noop ("# processing result set cut short due to load"),
                                1,
                                GNUNET_NO);
-      GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_NO);
+      GNUNET_DATASTORE_cancel (pr->qe);
+      pr->qe = NULL;
+      if (NULL != (cont = pr->llc_cont))
+       {
+         pr->llc_cont = NULL;
+         cont (pr->llc_cont_cls,
+               pr,
+               pr->local_result);
+       }
       return;
     }
-  GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (GSF_dsh);
 }
 
 
@@ -1162,7 +1148,6 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
   prq.expiration = expiration;
   prq.priority = 0;
   prq.anonymity_level = 1;
-  prq.finished = GNUNET_NO;
   prq.request_found = GNUNET_NO;
   GNUNET_CONTAINER_multihashmap_get_multiple (pr_map,
                                              &query,
index a25659e220840a41bd045fa048f56d24f8e96780..ea464e57811cb298a0c1c4cef36cf9fd5599aad5 100644 (file)
@@ -162,16 +162,12 @@ struct GSF_PendingRequestData
  * @param expiration when does 'data' expire?
  * @param data response data, NULL on request expiration
  * @param data_len number of bytes in data
- * @param more GNUNET_YES if the request remains active (may call
- *             this function again), GNUNET_NO if the request is
- *             finished (client must not call GSF_pending_request_cancel_)
  */
 typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
                                               struct GSF_PendingRequest *pr,
                                               struct GNUNET_TIME_Absolute expiration,
                                               const void *data,
-                                              size_t data_len,
-                                              int more);
+                                              size_t data_len);
 
 
 /**
index da781bc071991345bbfb8212bb2f0bb0b760b4d8..e720f392f57b041119bec7610b4029b1ba08568e 100644 (file)
@@ -479,7 +479,7 @@ process_migration_content (void *cls,
       MIN_MIGRATION_CONTENT_LIFETIME.rel_value)
     {
       /* content will expire soon, don't bother */
-      GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+      GNUNET_DATASTORE_get_next (GSF_dsh);
       return;
     }
   if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
@@ -491,7 +491,7 @@ process_migration_content (void *cls,
                                            &process_migration_content,
                                            NULL))
        {
-         GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+         GNUNET_DATASTORE_get_next (GSF_dsh);
        }
       return;
     }
@@ -522,7 +522,7 @@ process_migration_content (void *cls,
        }
       pos = pos->next;
     }
-  GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (GSF_dsh);
 }
 
 
index 97a7a90b503e7179ee854e8b79f1382a6e184d9f..5fd2ce81c4a551e266aee9a54b5f10cfa271dc9d 100644 (file)
@@ -109,7 +109,7 @@ static void
 dht_put_continuation (void *cls,
                      const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
+  GNUNET_DATASTORE_get_next (GSF_dsh);
 }