aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-02-22 10:48:44 +0000
committerChristian Grothoff <christian@grothoff.org>2010-02-22 10:48:44 +0000
commit391ab060f50b3c705c021c1cd0f73caffd7ef538 (patch)
treef67ce72ba77799ceaa3f9d54888c05c80131e6da
parentbbb37441d14a3bf0b7224d06255a0a638e522bb2 (diff)
downloadgnunet-391ab060f50b3c705c021c1cd0f73caffd7ef538.tar.gz
gnunet-391ab060f50b3c705c021c1cd0f73caffd7ef538.zip
fix cleanup
-rw-r--r--src/datastore/gnunet-service-datastore.c48
-rw-r--r--src/datastore/plugin_datastore_sqlite.c4
2 files changed, 17 insertions, 35 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 8a3510946..d519bcea5 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -930,6 +930,7 @@ handle_get (void *cls,
930 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 930 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
931 return; 931 return;
932 } 932 }
933 GNUNET_SERVER_client_keep (client);
933 msg = (const struct GetMessage*) message; 934 msg = (const struct GetMessage*) message;
934 if ( (size == sizeof(struct GetMessage)) && 935 if ( (size == sizeof(struct GetMessage)) &&
935 (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter, 936 (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter,
@@ -942,13 +943,11 @@ handle_get (void *cls,
942 "GET", 943 "GET",
943 GNUNET_h2s (&msg->key)); 944 GNUNET_h2s (&msg->key));
944#endif 945#endif
945 GNUNET_SERVER_client_keep (client);
946 transmit_item (client, 946 transmit_item (client,
947 NULL, NULL, 0, NULL, 0, 0, 0, 947 NULL, NULL, 0, NULL, 0, 0, 0,
948 GNUNET_TIME_UNIT_ZERO_ABS, 0); 948 GNUNET_TIME_UNIT_ZERO_ABS, 0);
949 return; 949 return;
950 } 950 }
951 GNUNET_SERVER_client_keep (client);
952 plugin->api->get (plugin->api->cls, 951 plugin->api->get (plugin->api->cls,
953 ((size == sizeof(struct GetMessage)) ? &msg->key : NULL), 952 ((size == sizeof(struct GetMessage)) ? &msg->key : NULL),
954 NULL, 953 NULL,
@@ -1236,6 +1235,20 @@ unload_plugin (struct DatastorePlugin *plug)
1236static void 1235static void
1237cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1236cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1238{ 1237{
1238 struct TransmitCallbackContext *tcc;
1239
1240 while (NULL != (tcc = tcc_head))
1241 {
1242 GNUNET_CONTAINER_DLL_remove (tcc_head,
1243 tcc_tail,
1244 tcc);
1245 if (tcc->th != NULL)
1246 GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
1247 if (NULL != tcc->tc)
1248 tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
1249 GNUNET_free (tcc->msg);
1250 GNUNET_free (tcc);
1251 }
1239 if (expired_kill_task != GNUNET_SCHEDULER_NO_TASK) 1252 if (expired_kill_task != GNUNET_SCHEDULER_NO_TASK)
1240 { 1253 {
1241 GNUNET_SCHEDULER_cancel (sched, 1254 GNUNET_SCHEDULER_cancel (sched,
@@ -1296,36 +1309,6 @@ cleanup_reservations (void *cls,
1296 1309
1297 1310
1298/** 1311/**
1299 * Function that removes all active reservations made
1300 * by the given client and releases the space for other
1301 * requests.
1302 *
1303 * @param cls closure
1304 * @param client identification of the client
1305 */
1306static void
1307cleanup_transmits (void *cls,
1308 struct GNUNET_SERVER_Client
1309 * client)
1310{
1311 struct TransmitCallbackContext *tcc;
1312
1313 while (NULL != (tcc = tcc_head))
1314 {
1315 GNUNET_CONTAINER_DLL_remove (tcc_head,
1316 tcc_tail,
1317 tcc);
1318 if (tcc->th != NULL)
1319 GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
1320 GNUNET_free (tcc->msg);
1321 GNUNET_free (tcc);
1322 }
1323
1324}
1325
1326
1327
1328/**
1329 * Process datastore requests. 1312 * Process datastore requests.
1330 * 1313 *
1331 * @param cls closure 1314 * @param cls closure
@@ -1389,7 +1372,6 @@ run (void *cls,
1389 return; 1372 return;
1390 } 1373 }
1391 GNUNET_SERVER_disconnect_notify (server, &cleanup_reservations, NULL); 1374 GNUNET_SERVER_disconnect_notify (server, &cleanup_reservations, NULL);
1392 GNUNET_SERVER_disconnect_notify (server, &cleanup_transmits, NULL);
1393 GNUNET_SERVER_add_handlers (server, handlers); 1375 GNUNET_SERVER_add_handlers (server, handlers);
1394 expired_kill_task 1376 expired_kill_task
1395 = GNUNET_SCHEDULER_add_with_priority (sched, 1377 = GNUNET_SCHEDULER_add_with_priority (sched,
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 1607ba5e0..2fc28e13e 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -1427,7 +1427,7 @@ sqlite_plugin_get (void *cls,
1427 sqlite_plugin_iter_low_priority (cls, type, iter, iter_cls); 1427 sqlite_plugin_iter_low_priority (cls, type, iter, iter_cls);
1428 return; 1428 return;
1429 } 1429 }
1430 GNUNET_snprintf (scratch, 256, 1430 GNUNET_snprintf (scratch, sizeof (scratch),
1431 "SELECT count(*) FROM gn080 WHERE hash=:1%s%s", 1431 "SELECT count(*) FROM gn080 WHERE hash=:1%s%s",
1432 vhash == NULL ? "" : " AND vhash=:2", 1432 vhash == NULL ? "" : " AND vhash=:2",
1433 type == 0 ? "" : (vhash == 1433 type == 0 ? "" : (vhash ==
@@ -1479,7 +1479,7 @@ sqlite_plugin_get (void *cls,
1479 return; 1479 return;
1480 } 1480 }
1481 1481
1482 GNUNET_snprintf (scratch, 256, 1482 GNUNET_snprintf (scratch, sizeof (scratch),
1483 "SELECT size, type, prio, anonLevel, expire, hash, value, _ROWID_ " 1483 "SELECT size, type, prio, anonLevel, expire, hash, value, _ROWID_ "
1484 "FROM gn080 WHERE hash=:1%s%s AND _ROWID_ >= :%d " 1484 "FROM gn080 WHERE hash=:1%s%s AND _ROWID_ >= :%d "
1485 "ORDER BY _ROWID_ ASC LIMIT 1 OFFSET :d", 1485 "ORDER BY _ROWID_ ASC LIMIT 1 OFFSET :d",