fix
[oweals/gnunet.git] / src / datastore / datastore_api.c
index 99060bd6057d418759e5c7aca8b91ac16a646562..660e8f10237eeca4db154a0f644e8521924a3099 100644 (file)
@@ -854,9 +854,10 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
 
 #if DEBUG_DATASTORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Asked to put %u bytes of data under key `%s'\n",
+             "Asked to put %u bytes of data under key `%s' for %llu ms\n",
              size,
-             GNUNET_h2s (key));
+             GNUNET_h2s (key),
+             GNUNET_TIME_absolute_get_remaining (expiration).rel_value);
 #endif
   msize = sizeof(struct DataMessage) + size;
   GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
@@ -885,6 +886,8 @@ GNUNET_DATASTORE_put (struct GNUNET_DATASTORE_Handle *h,
   dm->type = htonl(type);
   dm->priority = htonl(priority);
   dm->anonymity = htonl(anonymity);
+  dm->replication = htonl (replication);
+  dm->reserved = htonl (0);
   dm->uid = GNUNET_htonll(0);
   dm->expiration = GNUNET_TIME_absolute_hton(expiration);
   dm->key = *key;
@@ -1212,12 +1215,12 @@ process_result_message (void *cls,
          GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                      _("Failed to receive response from database.\n"));
          do_disconnect (h);
+         free_queue_entry (qe);
+         if (rc.proc != NULL)
+           rc.proc (rc.proc_cls,
+                    NULL, 0, NULL, 0, 0, 0, 
+                    GNUNET_TIME_UNIT_ZERO_ABS, 0);    
        }
-      free_queue_entry (qe);
-      if (rc.proc != NULL)
-       rc.proc (rc.proc_cls,
-                NULL, 0, NULL, 0, 0, 0, 
-                GNUNET_TIME_UNIT_ZERO_ABS, 0);    
       return;
     }
   if (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END)