fix
[oweals/gnunet.git] / src / fs / gnunet-service-fs_drq.c
index 8edcacf3dcc9ad584a94d59e5569a78b2feaf586..b549c6707ab5979988bd9eb5758eeb45ad7b9aea 100644 (file)
@@ -83,7 +83,7 @@ struct DatastoreRequestQueue
   /**
    * Datastore entry type we are doing the 'get' for.
    */
-  uint32_t type;
+  enum GNUNET_BLOCK_Type type;
 
   /**
    * Is this request at the head of the queue irrespective of its
@@ -113,10 +113,6 @@ static struct DatastoreRequestQueue *drq_head;
  */
 static struct DatastoreRequestQueue *drq_tail;
 
-/**
- * Our connection to the datastore.
- */
-static struct GNUNET_DATASTORE_Handle *dsh;
 
 /**
  * Pointer to the currently actively running request,
@@ -154,7 +150,7 @@ get_iterator (void *cls,
              const GNUNET_HashCode * key,
              uint32_t size,
              const void *data,
-             uint32_t type,
+             enum GNUNET_BLOCK_Type type,
              uint32_t priority,
              uint32_t anonymity,
              struct GNUNET_TIME_Absolute
@@ -222,9 +218,10 @@ run_next_request (void *cls,
   GNUNET_DATASTORE_get (dsh, 
                        &gc->key,
                        gc->type, 
+                       42 /* FIXME */, 64 /* FIXME */,
+                       GNUNET_TIME_absolute_get_remaining(gc->timeout),
                        &get_iterator,
-                       gc,
-                       GNUNET_TIME_absolute_get_remaining(gc->timeout));
+                       gc);
 }
 
 
@@ -294,9 +291,6 @@ shutdown_task (void *cls,
              "DRQ shutdown initiated\n");
 #endif
   GNUNET_assert (NULL != dsh);
-  GNUNET_DATASTORE_disconnect (dsh,
-                              GNUNET_NO);
-  dsh = NULL;
   while (NULL != (drq = drq_head))
     {
       drq_head = drq->next;
@@ -345,7 +339,7 @@ shutdown_task (void *cls,
  */
 struct DatastoreRequestQueue *
 GNUNET_FS_drq_get (const GNUNET_HashCode * key,
-                  uint32_t type,
+                  enum GNUNET_BLOCK_Type type,
                   GNUNET_DATASTORE_Iterator iter, 
                   void *iter_cls,
                   struct GNUNET_TIME_Relative timeout,
@@ -464,7 +458,6 @@ drq_remove_cont (void *cls,
   rc->cont (rc->cont_cls,
            success,
            msg);
-  GNUNET_DATASTORE_disconnect (rc->rmdsh, GNUNET_NO);
   GNUNET_free (rc);
 }
 
@@ -493,8 +486,6 @@ GNUNET_FS_drq_remove (const GNUNET_HashCode *key,
   struct GNUNET_DATASTORE_Handle *rmdsh; 
   struct RemoveContext *rc;
 
-  rmdsh = GNUNET_DATASTORE_connect (cfg,
-                                   sched);
   if (rmdsh == NULL)
     {
       GNUNET_break (0);
@@ -508,8 +499,10 @@ GNUNET_FS_drq_remove (const GNUNET_HashCode *key,
   rc->cont_cls = cont_cls;
   rc->rmdsh = rmdsh;
   GNUNET_DATASTORE_remove (rmdsh, key, size, data,
+                          -3, 128,
+                          timeout,
                           &drq_remove_cont, 
-                          rc, timeout);
+                          rc);
 }