aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/perf_datastore_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-04-15 20:12:21 +0000
committerChristian Grothoff <christian@grothoff.org>2011-04-15 20:12:21 +0000
commitae6871c097e55b61d10a66428b1c9a732a0fe803 (patch)
treeb95dd510cc8d44bf2cdd59344353de9554e36938 /src/datastore/perf_datastore_api.c
parentadfeb308f7af770dd7ff16b3e5ce79943ddb6818 (diff)
downloadgnunet-ae6871c097e55b61d10a66428b1c9a732a0fe803.tar.gz
gnunet-ae6871c097e55b61d10a66428b1c9a732a0fe803.zip
fixes
Diffstat (limited to 'src/datastore/perf_datastore_api.c')
-rw-r--r--src/datastore/perf_datastore_api.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 306e6d5e0..6ea65c68d 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -88,7 +88,8 @@ enum RunPhase
88 RP_DONE = 0, 88 RP_DONE = 0,
89 RP_PUT, 89 RP_PUT,
90 RP_CUT, 90 RP_CUT,
91 RP_REPORT 91 RP_REPORT,
92 RP_ERROR
92 }; 93 };
93 94
94 95
@@ -116,10 +117,16 @@ check_success (void *cls,
116 const char *msg) 117 const char *msg)
117{ 118{
118 struct CpsRunContext *crc = cls; 119 struct CpsRunContext *crc = cls;
120
119 if (GNUNET_OK != success) 121 if (GNUNET_OK != success)
120 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 122 {
121 "%s\n", msg); 123 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
122 GNUNET_assert (GNUNET_OK == success); 124 "Check success failed: `%s'\n", msg);
125 crc->phase = RP_ERROR;
126 GNUNET_SCHEDULER_add_now (&run_continuation,
127 crc);
128 return;
129 }
123#if REPORT_ID 130#if REPORT_ID
124 fprintf (stderr, "I"); 131 fprintf (stderr, "I");
125#endif 132#endif
@@ -157,6 +164,15 @@ remove_next(void *cls,
157{ 164{
158 struct CpsRunContext *crc = cls; 165 struct CpsRunContext *crc = cls;
159 166
167 if (GNUNET_OK != success)
168 {
169 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
170 "remove_next failed: `%s'\n", msg);
171 crc->phase = RP_ERROR;
172 GNUNET_SCHEDULER_add_now (&run_continuation,
173 crc);
174 return;
175 }
160#if REPORT_ID 176#if REPORT_ID
161 fprintf (stderr, "D"); 177 fprintf (stderr, "D");
162#endif 178#endif
@@ -168,7 +184,7 @@ remove_next(void *cls,
168 184
169static void 185static void
170delete_value (void *cls, 186delete_value (void *cls,
171 const GNUNET_HashCode * key, 187 const GNUNET_HashCode *key,
172 size_t size, 188 size_t size,
173 const void *data, 189 const void *data,
174 enum GNUNET_BLOCK_Type type, 190 enum GNUNET_BLOCK_Type type,
@@ -178,7 +194,7 @@ delete_value (void *cls,
178 expiration, uint64_t uid) 194 expiration, uint64_t uid)
179{ 195{
180 struct CpsRunContext *crc = cls; 196 struct CpsRunContext *crc = cls;
181 197
182 GNUNET_assert (NULL != key); 198 GNUNET_assert (NULL != key);
183 stored_ops++; 199 stored_ops++;
184 stored_bytes -= size; 200 stored_bytes -= size;
@@ -275,6 +291,11 @@ run_continuation (void *cls,
275 GNUNET_free (crc); 291 GNUNET_free (crc);
276 ok = 0; 292 ok = 0;
277 break; 293 break;
294 case RP_ERROR:
295 GNUNET_DATASTORE_disconnect (datastore, GNUNET_YES);
296 GNUNET_free (crc);
297 ok = 1;
298 break;
278 default: 299 default:
279 GNUNET_assert (0); 300 GNUNET_assert (0);
280 } 301 }
@@ -383,7 +404,6 @@ main (int argc, char *argv[])
383 char *pos; 404 char *pos;
384 char dir_name[128]; 405 char dir_name[128];
385 406
386 if (1) return 0;
387 /* determine name of plugin to use */ 407 /* determine name of plugin to use */
388 plugin_name = argv[0]; 408 plugin_name = argv[0];
389 while (NULL != (pos = strstr(plugin_name, "_"))) 409 while (NULL != (pos = strstr(plugin_name, "_")))