[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8749 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8749 - gnunet/src/datastore |
Date: |
Sun, 19 Jul 2009 03:10:43 -0600 |
Author: grothoff
Date: 2009-07-19 03:10:43 -0600 (Sun, 19 Jul 2009)
New Revision: 8749
Modified:
gnunet/src/datastore/datastore_api.c
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/datastore/test_datastore_api.c
Log:
debug messages
Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c 2009-07-18 22:24:00 UTC (rev
8748)
+++ gnunet/src/datastore/datastore_api.c 2009-07-19 09:10:43 UTC (rev
8749)
@@ -215,6 +215,12 @@
}
}
h->response_proc = NULL;
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received status %d/%s\n",
+ status,
+ emsg);
+#endif
cont (h->response_proc_cls,
status,
emsg);
@@ -251,6 +257,11 @@
}
GNUNET_assert (h->message_size <= size);
memcpy (buf, &h[1], h->message_size);
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitted %u byte message to datastore service, now waiting
for status.\n",
+ h->message_size);
+#endif
h->message_size = 0;
GNUNET_CLIENT_receive (h->client,
&with_status_response_handler,
@@ -284,6 +295,12 @@
hdr = (const struct GNUNET_MessageHeader*) &h[1];
msize = ntohs(hdr->size);
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting %u byte message of type %u to datastore service\n",
+ msize,
+ ntohs(hdr->type));
+#endif
GNUNET_assert (h->response_proc == NULL);
h->response_proc = cont;
h->response_proc_cls = cont_cls;
@@ -485,6 +502,10 @@
{
GNUNET_break (ntohs(msg->size) == sizeof(struct GNUNET_MessageHeader));
h->response_proc = NULL;
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received end of result set\n");
+#endif
cont (h->response_proc_cls,
NULL, 0, NULL, 0, 0, 0, zero, 0);
return;
@@ -512,6 +533,14 @@
NULL, 0, NULL, 0, 0, 0, zero, 0);
return;
}
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received result %llu with type %u and size %u with key %s\n",
+ (unsigned long long) GNUNET_ntohll(dm->uid),
+ ntohl(dm->type),
+ msize,
+ GNUNET_h2s(&dm->key));
+#endif
cont (h->response_proc_cls,
&dm->key,
msize,
@@ -558,6 +587,11 @@
}
GNUNET_assert (h->message_size <= size);
memcpy (buf, &h[1], h->message_size);
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitted %u byte message to datastore service, now waiting
for result.\n",
+ h->message_size);
+#endif
h->message_size = 0;
GNUNET_CLIENT_receive (h->client,
&with_result_response_handler,
@@ -592,6 +626,12 @@
hdr = (const struct GNUNET_MessageHeader*) &h[1];
msize = ntohs(hdr->size);
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting %u byte message of type %u to datastore service\n",
+ msize,
+ ntohs(hdr->type));
+#endif
GNUNET_assert (h->response_proc == NULL);
h->response_proc = cont;
h->response_proc_cls = cont_cls;
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2009-07-18 22:24:00 UTC
(rev 8748)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2009-07-19 09:10:43 UTC
(rev 8749)
@@ -38,6 +38,8 @@
#include "plugin_datastore.h"
#include "datastore.h"
+#define DEBUG_DATASTORE GNUNET_YES
+
/**
* How many messages do we queue at most per client?
*/
@@ -197,10 +199,20 @@
msize = ntohs(tcc->msg->size);
if (size == 0)
{
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Transmission failed.\n");
+#endif
if (tcc->tc != NULL)
tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
if (GNUNET_YES == tcc->end)
- GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
+ {
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Disconnecting client.\n");
+#endif
+ GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
+ }
GNUNET_free (tcc->msg);
GNUNET_free (tcc);
return 0;
@@ -210,7 +222,20 @@
if (tcc->tc != NULL)
tcc->tc (tcc->tc_cls, GNUNET_OK);
if (GNUNET_YES == tcc->end)
- GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
+ {
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Request completed, ready for the next request!\n");
+#endif
+ GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
+ }
+ else
+ {
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Response transmitted, more pending!\n");
+#endif
+ }
GNUNET_free (tcc->msg);
GNUNET_free (tcc);
return msize;
@@ -251,7 +276,13 @@
{
GNUNET_break (0);
if (GNUNET_YES == end)
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ {
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Disconnecting client.\n");
+#endif
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ }
if (NULL != tc)
tc (tc_cls, GNUNET_SYSERR);
GNUNET_free (msg);
@@ -275,6 +306,13 @@
struct StatusMessage *sm;
size_t slen;
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting `s' message with value %d and message %s\n",
+ "STATUS",
+ code,
+ msg);
+#endif
slen = (msg == NULL) ? 0 : strlen(msg) + 1;
sm = GNUNET_malloc (sizeof(struct StatusMessage) + slen);
sm->header.size = htons(sizeof(struct StatusMessage) + slen);
@@ -345,6 +383,11 @@
if (key == NULL)
{
/* transmit 'DATA_END' */
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting `%s' message\n",
+ "DATA_END");
+#endif
end = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader));
end->size = htons(sizeof(struct GNUNET_MessageHeader));
end->type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END);
@@ -364,6 +407,11 @@
dm->uid = GNUNET_htonll(uid);
dm->key = *key;
memcpy (&dm[1], data, size);
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transmitting `%s' message\n",
+ "DATA");
+#endif
transmit (client, &dm->header, &get_next, next_cls, GNUNET_NO);
return GNUNET_OK;
}
@@ -384,7 +432,12 @@
const struct ReserveMessage *msg = (const struct ReserveMessage*) message;
struct ReservationList *e;
- /* FIXME: check if we have that much space... */
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "RESERVE");
+#endif
+ /* FIXME: check if we have that much space... */
e = GNUNET_malloc (sizeof(struct ReservationList));
e->next = reservations;
reservations = e;
@@ -414,8 +467,13 @@
struct ReservationList *pos;
struct ReservationList *prev;
struct ReservationList *next;
-
int rid = ntohl(msg->rid);
+
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "RELEASE_RESERVE");
+#endif
next = reservations;
prev = NULL;
while (NULL != (pos = next))
@@ -490,6 +548,11 @@
int ret;
int rid;
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "PUT");
+#endif
if (dm == NULL)
{
GNUNET_break (0);
@@ -537,6 +600,11 @@
const struct GetMessage *msg;
uint16_t size;
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "GET");
+#endif
size = ntohs(message->size);
if ( (size != sizeof(struct GetMessage)) &&
(size != sizeof(struct GetMessage) - sizeof(GNUNET_HashCode)) )
@@ -581,6 +649,11 @@
int ret;
char *emsg;
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "UPDATE");
+#endif
msg = (const struct UpdateMessage*) message;
emsg = NULL;
ret = plugin->api->update (plugin->api->cls,
@@ -605,7 +678,12 @@
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
- GNUNET_SERVER_client_drop (client);
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "GET_RANDOM");
+#endif
+ GNUNET_SERVER_client_drop (client); // FIXME: WTF?
plugin->api->iter_migration_order (plugin->api->cls,
0,
&transmit_item,
@@ -681,6 +759,11 @@
GNUNET_HashCode vhash;
struct RemoveContext *rc;
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "REMOVE");
+#endif
if (dm == NULL)
{
GNUNET_break (0);
@@ -714,6 +797,11 @@
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+#if DEBUG_DATASTORE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Processing `%s' request\n",
+ "DROP");
+#endif
plugin->api->drop (plugin->api->cls);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
Modified: gnunet/src/datastore/test_datastore_api.c
===================================================================
--- gnunet/src/datastore/test_datastore_api.c 2009-07-18 22:24:00 UTC (rev
8748)
+++ gnunet/src/datastore/test_datastore_api.c 2009-07-19 09:10:43 UTC (rev
8749)
@@ -33,11 +33,15 @@
#include "gnunet_protocols.h"
#include "gnunet_datastore_service.h"
+#define VERBOSE GNUNET_YES
+
/**
* How long until we give up on transmitting the message?
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
+#define ITERATIONS 256
+
static struct GNUNET_DATASTORE_Handle *datastore;
static struct GNUNET_TIME_Absolute now;
@@ -250,7 +254,13 @@
switch (crc->phase)
{
case RP_PUT:
- memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing `%s' number %u\n",
+ "PUT",
+ crc->i);
+#endif
+ memset (&crc->key, ITERATIONS - crc->i, sizeof (GNUNET_HashCode));
GNUNET_DATASTORE_put (datastore,
0,
&crc->key,
@@ -264,12 +274,18 @@
&check_success,
crc);
crc->i++;
- if (crc->i == 256)
+ if (crc->i == ITERATIONS)
crc->phase = RP_GET;
break;
case RP_GET:
crc->i--;
- memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing `%s' number %u\n",
+ "GET",
+ crc->i);
+#endif
+ memset (&crc->key, ITERATIONS - crc->i, sizeof (GNUNET_HashCode));
GNUNET_DATASTORE_get (datastore,
&crc->key,
get_type (crc->i),
@@ -279,12 +295,18 @@
if (crc->i == 0)
{
crc->phase = RP_DEL;
- crc->i = 256;
+ crc->i = ITERATIONS;
}
break;
case RP_DEL:
crc->i--;
- memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing `%s' number %u\n",
+ "DEL",
+ crc->i);
+#endif
+ memset (&crc->key, ITERATIONS - crc->i, sizeof (GNUNET_HashCode));
GNUNET_DATASTORE_get (datastore,
&crc->key,
get_type (crc->i),
@@ -294,12 +316,18 @@
if (crc->i == 0)
{
crc->phase = RP_DELVALIDATE;
- crc->i = 256;
+ crc->i = ITERATIONS;
}
break;
case RP_DELVALIDATE:
crc->i--;
- memset (&crc->key, 256 - crc->i, sizeof (GNUNET_HashCode));
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Executing `%s' number %u\n",
+ "DEL-VALIDATE",
+ crc->i);
+#endif
+ memset (&crc->key, ITERATIONS - crc->i, sizeof (GNUNET_HashCode));
GNUNET_DATASTORE_get (datastore,
&crc->key,
get_type (crc->i),
@@ -315,6 +343,10 @@
/* check update */
/* test multiple results */
case RP_DONE:
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Finished, disconnecting\n");
+#endif
GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
ok = 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8749 - gnunet/src/datastore,
gnunet <=