[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14715 - in gnunet/src: datastore include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14715 - in gnunet/src: datastore include |
Date: |
Fri, 25 Mar 2011 09:48:14 +0100 |
Author: grothoff
Date: 2011-03-25 09:48:14 +0100 (Fri, 25 Mar 2011)
New Revision: 14715
Modified:
gnunet/src/datastore/datastore.h
gnunet/src/datastore/datastore_api.c
gnunet/src/datastore/perf_datastore_api.c
gnunet/src/datastore/test_datastore_api.c
gnunet/src/datastore/test_datastore_api_management.c
gnunet/src/include/gnunet_datastore_service.h
Log:
better API
Modified: gnunet/src/datastore/datastore.h
===================================================================
--- gnunet/src/datastore/datastore.h 2011-03-25 08:18:47 UTC (rev 14714)
+++ gnunet/src/datastore/datastore.h 2011-03-25 08:48:14 UTC (rev 14715)
@@ -27,7 +27,7 @@
#ifndef DATASTORE_H
#define DATASTORE_H
-#define DEBUG_DATASTORE GNUNET_NO
+#define DEBUG_DATASTORE GNUNET_YES
#include "gnunet_util_lib.h"
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2011-03-25 08:18:47 UTC (rev
14714)
+++ gnunet/src/datastore/datastore_api.c 2011-03-25 08:48:14 UTC (rev
14715)
@@ -1197,11 +1197,12 @@
if (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END)
{
GNUNET_break (ntohs(msg->size) == sizeof(struct GNUNET_MessageHeader));
+ free_queue_entry (qe);
#if DEBUG_DATASTORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received end of result set\n");
+ "Received end of result set, new queue size is %u\n",
+ h->queue_size);
#endif
- free_queue_entry (qe);
if (rc.iter != NULL)
rc.iter (rc.iter_cls,
NULL, 0, NULL, 0, 0, 0,
@@ -1247,7 +1248,7 @@
do_disconnect (h);
return;
}
- GNUNET_DATASTORE_get_next (h, GNUNET_NO);
+ GNUNET_DATASTORE_get_next (h);
return;
}
dm = (const struct DataMessage*) msg;
@@ -1473,26 +1474,13 @@
* from the datastore.
*
* @param h handle to the datastore
- * @param more GNUNET_YES to get moxre results, GNUNET_NO to abort
- * iteration (with a final call to "iter" with key/data == NULL).
*/
void
-GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h,
- int more)
+GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h)
{
struct GNUNET_DATASTORE_QueueEntry *qe = h->queue_head;
- struct ResultContext rc = qe->qc.rc;
GNUNET_assert (&process_result_message == qe->response_proc);
- if (GNUNET_YES != more)
- {
- qe->qc.rc.iter = NULL;
- qe->qc.rc.iter_cls = NULL;
- if (rc.iter != NULL)
- rc.iter (rc.iter_cls,
- NULL, 0, NULL, 0, 0, 0,
- GNUNET_TIME_UNIT_ZERO_ABS, 0);
- }
h->in_receive = GNUNET_YES;
GNUNET_CLIENT_receive (h->client,
qe->response_proc,
@@ -1511,7 +1499,6 @@
GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe)
{
struct GNUNET_DATASTORE_Handle *h;
- int reconnect;
h = qe->h;
#if DEBUG_DATASTORE
@@ -1521,19 +1508,11 @@
qe->was_transmitted,
h->queue_head == qe);
#endif
- reconnect = GNUNET_NO;
if (GNUNET_YES == qe->was_transmitted)
{
- if (qe->response_proc == &process_result_message)
- {
- qe->qc.rc.iter = NULL;
- if (GNUNET_YES != h->in_receive)
- GNUNET_DATASTORE_get_next (h, GNUNET_YES);
- }
- else
- {
- qe->qc.sc.cont = NULL;
- }
+ free_queue_entry (qe);
+ h->retry_time = GNUNET_TIME_UNIT_ZERO;
+ do_disconnect (h);
return;
}
free_queue_entry (qe);
Modified: gnunet/src/datastore/perf_datastore_api.c
===================================================================
--- gnunet/src/datastore/perf_datastore_api.c 2011-03-25 08:18:47 UTC (rev
14714)
+++ gnunet/src/datastore/perf_datastore_api.c 2011-03-25 08:48:14 UTC (rev
14715)
@@ -223,13 +223,13 @@
stored_ops++;
if (stored_bytes < MAX_SIZE)
{
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
return;
}
crc->key = *key;
crc->esize = size;
memcpy (crc->data, data, size);
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
Modified: gnunet/src/datastore/test_datastore_api.c
===================================================================
--- gnunet/src/datastore/test_datastore_api.c 2011-03-25 08:18:47 UTC (rev
14714)
+++ gnunet/src/datastore/test_datastore_api.c 2011-03-25 08:48:14 UTC (rev
14715)
@@ -210,7 +210,7 @@
GNUNET_assert (priority == get_priority (i));
GNUNET_assert (anonymity == get_anonymity(i));
GNUNET_assert (expiration.abs_value == get_expiration(i).abs_value);
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
@@ -249,7 +249,7 @@
crc->key = *key;
crc->data = GNUNET_malloc (size);
memcpy (crc->data, data, size);
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
@@ -329,7 +329,7 @@
#endif
if (priority == get_priority (42))
crc->uid = uid;
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
@@ -370,7 +370,7 @@
}
else
GNUNET_assert (size == get_size (43));
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
Modified: gnunet/src/datastore/test_datastore_api_management.c
===================================================================
--- gnunet/src/datastore/test_datastore_api_management.c 2011-03-25
08:18:47 UTC (rev 14714)
+++ gnunet/src/datastore/test_datastore_api_management.c 2011-03-25
08:48:14 UTC (rev 14715)
@@ -181,7 +181,7 @@
GNUNET_assert (priority == get_priority (i));
GNUNET_assert (anonymity == get_anonymity(i));
GNUNET_assert (expiration.abs_value == get_expiration(i).abs_value);
- GNUNET_DATASTORE_get_next (datastore, GNUNET_YES);
+ GNUNET_DATASTORE_get_next (datastore);
}
Modified: gnunet/src/include/gnunet_datastore_service.h
===================================================================
--- gnunet/src/include/gnunet_datastore_service.h 2011-03-25 08:18:47 UTC
(rev 14714)
+++ gnunet/src/include/gnunet_datastore_service.h 2011-03-25 08:48:14 UTC
(rev 14715)
@@ -317,12 +317,9 @@
* from the datastore.
*
* @param h handle to the datastore
- * @param more GNUNET_YES to get moxre results, GNUNET_NO to abort
- * iteration (with a final call to "iter" with key/data == NULL).
*/
void
-GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h,
- int more);
+GNUNET_DATASTORE_get_next (struct GNUNET_DATASTORE_Handle *h);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14715 - in gnunet/src: datastore include,
gnunet <=