From: Christian Grothoff Date: Thu, 26 Aug 2010 12:14:19 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~20536 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bf99b4a4df68b7fc2de68ee09a0526cf72fe66d0;p=oweals%2Fgnunet.git fixes --- diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index b4540828a..9473bbbed 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -523,11 +523,13 @@ postgres_plugin_put (void *cls, return GNUNET_SYSERR; PQclear (ret); plugin->payload += size; +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Stored %u bytes in database, new payload is %llu\n", (unsigned int) size, (unsigned long long) plugin->payload); +#endif return GNUNET_OK; } @@ -561,10 +563,12 @@ postgres_next_request_cont (void *next_cls, if ( (GNUNET_YES == nrc->end_it) || (nrc->count == nrc->total) ) { +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Ending iteration (%s)\n", (GNUNET_YES == nrc->end_it) ? "client requested it" : "completed result set"); +#endif nrc->iter (nrc->iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); @@ -592,9 +596,11 @@ postgres_next_request_cont (void *next_cls, nrc->pname, __LINE__)) { +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Ending iteration (postgres error)\n"); +#endif nrc->iter (nrc->iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); @@ -605,9 +611,11 @@ postgres_next_request_cont (void *next_cls, if (0 == PQntuples (res)) { /* no result */ +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Ending iteration (no more results)\n"); +#endif nrc->iter (nrc->iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); @@ -659,11 +667,13 @@ postgres_next_request_cont (void *next_cls, nrc->blast_rowid = htonl (rowid); nrc->count++; +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Found result of size %u bytes and type %u in database\n", (unsigned int) size, (unsigned int) type); +#endif iret = nrc->iter (nrc->iter_cls, nrc, &key, @@ -677,27 +687,33 @@ postgres_next_request_cont (void *next_cls, PQclear (res); if (iret == GNUNET_SYSERR) { +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Ending iteration (client error)\n"); +#endif return; } if (iret == GNUNET_NO) { if (GNUNET_OK == delete_by_rowid (plugin, rowid)) { +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Deleting %u bytes from database, current payload is %llu\n", (unsigned int) size, (unsigned long long) plugin->payload); +#endif GNUNET_assert (plugin->payload >= size); plugin->payload -= size; +#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "postgres", "Deleted %u bytes from database, new payload is %llu\n", (unsigned int) size, (unsigned long long) plugin->payload); +#endif } } } @@ -1048,8 +1064,6 @@ postgres_plugin_get (void *cls, return; } nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0)); - fprintf (stderr, "Total number of results: %llu\n", - (unsigned long long) nrc->total); PQclear (ret); if (nrc->total == 0) { diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index aaa00bdd8..0ea3c4c86 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c @@ -31,7 +31,7 @@ #include "gnunet_protocols.h" #include "gnunet_datastore_service.h" -#define VERBOSE GNUNET_YES +#define VERBOSE GNUNET_NO #define START_DATASTORE GNUNET_YES diff --git a/src/datastore/test_datastore_api_data_postgres.conf b/src/datastore/test_datastore_api_data_postgres.conf index 4d4b94d05..0bc55852e 100644 --- a/src/datastore/test_datastore_api_data_postgres.conf +++ b/src/datastore/test_datastore_api_data_postgres.conf @@ -30,7 +30,7 @@ DISABLE_SOCKET_FORWARDING = YES # REJECT_FROM = # REJECT_FROM6 = # PREFIX = -DEBUG = YES +# DEBUG = YES # PREFIX = xterm -T datastore -e gdb --args # PREFIX = valgrind --tool=memcheck --leak-check=yes BINARY = gnunet-service-datastore