reservations
[oweals/gnunet.git] / src / datastore / datastore_api.c
index 6f02e6fea75941916a7f521084cded3a542da886..f9a28800c94ea832cdc3006050d8fc2aac414294 100644 (file)
@@ -294,6 +294,7 @@ transmit_for_status (struct GNUNET_DATASTORE_Handle *h,
   const struct GNUNET_MessageHeader *hdr;
   uint16_t msize;
 
+  GNUNET_assert (cont != NULL);
   hdr = (const struct GNUNET_MessageHeader*) &h[1];
   msize = ntohs(hdr->size);
 #if DEBUG_DATASTORE
@@ -396,7 +397,7 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
 void
 GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
                          uint64_t amount,
-                         uint64_t entries,
+                         uint32_t entries,
                          GNUNET_DATASTORE_ContinuationWithStatus cont,
                          void *cont_cls,
                          struct GNUNET_TIME_Relative timeout)
@@ -406,9 +407,8 @@ GNUNET_DATASTORE_reserve (struct GNUNET_DATASTORE_Handle *h,
   rm = (struct ReserveMessage*) &h[1];
   rm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE);
   rm->header.size = htons(sizeof (struct ReserveMessage));
-  rm->reserved = htonl(0);
-  rm->amount = htonl(amount);
   rm->entries = htonl(entries);
+  rm->amount = htonl(amount);
   transmit_for_status (h, cont, cont_cls, timeout);
 }
 
@@ -582,9 +582,9 @@ transmit_get_result (void *cls,
   GNUNET_DATASTORE_ContinuationWithStatus cont = h->response_proc;
   uint16_t msize;
 
-  h->response_proc = NULL;
   if (buf == NULL)
     {
+      h->response_proc = NULL;
       h->message_size = 0;
       cont (h->response_proc_cls, 
            GNUNET_SYSERR,
@@ -631,6 +631,7 @@ transmit_for_result (struct GNUNET_DATASTORE_Handle *h,
   const struct GNUNET_MessageHeader *hdr;
   uint16_t msize;
 
+  GNUNET_assert (cont != NULL);
   hdr = (const struct GNUNET_MessageHeader*) &h[1];
   msize = ntohs(hdr->size);
 #if DEBUG_DATASTORE