- added check against statistics
[oweals/gnunet.git] / src / datastore / datastore_api.c
index 3ab3d2503f2f2e167744942ae89e5f85bc3e1a84..4f406a2bcadfa01db5395038347172dc64338359 100644 (file)
@@ -601,8 +601,9 @@ transmit_request (void *cls, size_t size, void *buf)
     return 0;                   /* no entry in queue */
   if (buf == NULL)
   {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _("Failed to transmit request to DATASTORE.\n"));
+#if DEBUG_DATASTORE
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to DATASTORE.\n");
+#endif
     GNUNET_STATISTICS_update (h->stats,
                               gettext_noop ("# transmission request failures"),
                               1, GNUNET_NO);
@@ -696,10 +697,13 @@ process_queue (struct GNUNET_DATASTORE_Handle *h)
  *
  * @param cls closure
  * @param result result
+ * @param min_expiration expiration time
  * @param emsg error message
  */
 static void
-drop_status_cont (void *cls, int32_t result, const char *emsg)
+drop_status_cont (void *cls, int32_t result, 
+                 struct GNUNET_TIME_Absolute min_expiration,
+                 const char *emsg)
 {
   /* do nothing */
 }
@@ -764,6 +768,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
       process_queue (h);
     if (rc.cont != NULL)
       rc.cont (rc.cont_cls, GNUNET_SYSERR,
+              GNUNET_TIME_UNIT_ZERO_ABS,
                _("Failed to receive status response from database."));
     return;
   }
@@ -777,6 +782,7 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
     do_disconnect (h);
     if (rc.cont != NULL)
       rc.cont (rc.cont_cls, GNUNET_SYSERR,
+              GNUNET_TIME_UNIT_ZERO_ABS,
                _("Error reading response from datastore service"));
     return;
   }
@@ -806,7 +812,9 @@ process_status_message (void *cls, const struct GNUNET_MessageHeader *msg)
   h->retry_time.rel_value = 0;
   process_queue (h);
   if (rc.cont != NULL)
-    rc.cont (rc.cont_cls, status, emsg);
+    rc.cont (rc.cont_cls, status, 
+            GNUNET_TIME_absolute_ntoh (sm->min_expiration),
+            emsg);
 }
 
 
@@ -1205,12 +1213,12 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Received end of result set, new queue size is %u\n", h->queue_size);
 #endif
-    if (rc.proc != NULL)
-      rc.proc (rc.proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS,
-               0);
     h->retry_time.rel_value = 0;
     h->result_count = 0;
     process_queue (h);
+    if (rc.proc != NULL)
+      rc.proc (rc.proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS,
+               0);
     return;
   }
   qe = h->queue_head;