aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/gnunet-service-datastore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore/gnunet-service-datastore.c')
-rw-r--r--src/datastore/gnunet-service-datastore.c242
1 files changed, 62 insertions, 180 deletions
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 566a227c1..deab62dd0 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -209,18 +209,6 @@ sync_stats ()
209 209
210 210
211 211
212
213/**
214 * Function called once the transmit operation has
215 * either failed or succeeded.
216 *
217 * @param cls closure
218 * @param status GNUNET_OK on success, GNUNET_SYSERR on error
219 */
220typedef void (*TransmitContinuation)(void *cls,
221 int status);
222
223
224/** 212/**
225 * Context for transmitting replies to clients. 213 * Context for transmitting replies to clients.
226 */ 214 */
@@ -252,22 +240,6 @@ struct TransmitCallbackContext
252 */ 240 */
253 struct GNUNET_SERVER_Client *client; 241 struct GNUNET_SERVER_Client *client;
254 242
255 /**
256 * Function to call once msg has been transmitted
257 * (or at least added to the buffer).
258 */
259 TransmitContinuation tc;
260
261 /**
262 * Closure for tc.
263 */
264 void *tc_cls;
265
266 /**
267 * GNUNET_YES if we are supposed to signal the server
268 * completion of the client's request.
269 */
270 int end;
271}; 243};
272 244
273 245
@@ -330,7 +302,6 @@ delete_expired (void *cls,
330 */ 302 */
331static int 303static int
332expired_processor (void *cls, 304expired_processor (void *cls,
333 void *next_cls,
334 const GNUNET_HashCode * key, 305 const GNUNET_HashCode * key,
335 uint32_t size, 306 uint32_t size,
336 const void *data, 307 const void *data,
@@ -396,7 +367,7 @@ delete_expired (void *cls,
396 const struct GNUNET_SCHEDULER_TaskContext *tc) 367 const struct GNUNET_SCHEDULER_TaskContext *tc)
397{ 368{
398 expired_kill_task = GNUNET_SCHEDULER_NO_TASK; 369 expired_kill_task = GNUNET_SCHEDULER_NO_TASK;
399 plugin->api->expiration_get (plugin->api->cls, 370 plugin->api->get_expiration (plugin->api->cls,
400 &expired_processor, 371 &expired_processor,
401 NULL); 372 NULL);
402} 373}
@@ -424,7 +395,6 @@ delete_expired (void *cls,
424 */ 395 */
425static int 396static int
426quota_processor (void *cls, 397quota_processor (void *cls,
427 void *next_cls,
428 const GNUNET_HashCode * key, 398 const GNUNET_HashCode * key,
429 uint32_t size, 399 uint32_t size,
430 const void *data, 400 const void *data,
@@ -487,7 +457,7 @@ manage_space (unsigned long long need)
487 (last != need) ) 457 (last != need) )
488 { 458 {
489 last = need; 459 last = need;
490 plugin->api->expiration_get (plugin->api->cls, 460 plugin->api->get_expiration (plugin->api->cls,
491 &quota_processor, 461 &quota_processor,
492 &need); 462 &need);
493 } 463 }
@@ -521,14 +491,7 @@ transmit_callback (void *cls,
521 { 491 {
522 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 492 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
523 _("Transmission to client failed!\n")); 493 _("Transmission to client failed!\n"));
524 if (tcc->tc != NULL) 494 GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
525 tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
526 if (GNUNET_YES == tcc->end)
527 {
528 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
529 _("Disconnecting client due to transmission failure!\n"));
530 GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
531 }
532 GNUNET_SERVER_client_drop (tcc->client); 495 GNUNET_SERVER_client_drop (tcc->client);
533 GNUNET_free (tcc->msg); 496 GNUNET_free (tcc->msg);
534 GNUNET_free (tcc); 497 GNUNET_free (tcc);
@@ -536,23 +499,7 @@ transmit_callback (void *cls,
536 } 499 }
537 GNUNET_assert (size >= msize); 500 GNUNET_assert (size >= msize);
538 memcpy (buf, tcc->msg, msize); 501 memcpy (buf, tcc->msg, msize);
539 if (tcc->tc != NULL) 502 GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
540 tcc->tc (tcc->tc_cls, GNUNET_OK);
541 if (GNUNET_YES == tcc->end)
542 {
543#if DEBUG_DATASTORE
544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
545 "Done processing client request\n");
546#endif
547 GNUNET_SERVER_receive_done (tcc->client, GNUNET_OK);
548 }
549 else
550 {
551#if DEBUG_DATASTORE
552 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
553 "Response transmitted, more pending!\n");
554#endif
555 }
556 GNUNET_SERVER_client_drop (tcc->client); 503 GNUNET_SERVER_client_drop (tcc->client);
557 GNUNET_free (tcc->msg); 504 GNUNET_free (tcc->msg);
558 GNUNET_free (tcc); 505 GNUNET_free (tcc);
@@ -567,16 +514,10 @@ transmit_callback (void *cls,
567 * @param msg message to transmit, will be freed! 514 * @param msg message to transmit, will be freed!
568 * @param tc function to call afterwards 515 * @param tc function to call afterwards
569 * @param tc_cls closure for tc 516 * @param tc_cls closure for tc
570 * @param end is this the last response (and we should
571 * signal the server completion accodingly after
572 * transmitting this message)?
573 */ 517 */
574static void 518static void
575transmit (struct GNUNET_SERVER_Client *client, 519transmit (struct GNUNET_SERVER_Client *client,
576 struct GNUNET_MessageHeader *msg, 520 struct GNUNET_MessageHeader *msg)
577 TransmitContinuation tc,
578 void *tc_cls,
579 int end)
580{ 521{
581 struct TransmitCallbackContext *tcc; 522 struct TransmitCallbackContext *tcc;
582 523
@@ -586,17 +527,13 @@ transmit (struct GNUNET_SERVER_Client *client,
586 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 527 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
587 "Shutdown in progress, aborting transmission.\n"); 528 "Shutdown in progress, aborting transmission.\n");
588#endif 529#endif
530 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
589 GNUNET_free (msg); 531 GNUNET_free (msg);
590 if (NULL != tc)
591 tc (tc_cls, GNUNET_SYSERR);
592 return; 532 return;
593 } 533 }
594 tcc = GNUNET_malloc (sizeof(struct TransmitCallbackContext)); 534 tcc = GNUNET_malloc (sizeof(struct TransmitCallbackContext));
595 tcc->msg = msg; 535 tcc->msg = msg;
596 tcc->client = client; 536 tcc->client = client;
597 tcc->tc = tc;
598 tcc->tc_cls = tc_cls;
599 tcc->end = end;
600 if (NULL == 537 if (NULL ==
601 (tcc->th = GNUNET_SERVER_notify_transmit_ready (client, 538 (tcc->th = GNUNET_SERVER_notify_transmit_ready (client,
602 ntohs(msg->size), 539 ntohs(msg->size),
@@ -605,14 +542,7 @@ transmit (struct GNUNET_SERVER_Client *client,
605 tcc))) 542 tcc)))
606 { 543 {
607 GNUNET_break (0); 544 GNUNET_break (0);
608 if (GNUNET_YES == end) 545 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
609 {
610 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
611 _("Forcefully disconnecting client.\n"));
612 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
613 }
614 if (NULL != tc)
615 tc (tc_cls, GNUNET_SYSERR);
616 GNUNET_free (msg); 546 GNUNET_free (msg);
617 GNUNET_free (tcc); 547 GNUNET_free (tcc);
618 return; 548 return;
@@ -653,33 +583,10 @@ transmit_status (struct GNUNET_SERVER_Client *client,
653 sm->status = htonl(code); 583 sm->status = htonl(code);
654 if (slen > 0) 584 if (slen > 0)
655 memcpy (&sm[1], msg, slen); 585 memcpy (&sm[1], msg, slen);
656 transmit (client, &sm->header, NULL, NULL, GNUNET_YES); 586 transmit (client, &sm->header);
657} 587}
658 588
659 589
660/**
661 * Function called once the transmit operation has
662 * either failed or succeeded.
663 *
664 * @param next_cls closure for calling "next_request" callback
665 * @param status GNUNET_OK on success, GNUNET_SYSERR on error
666 */
667static void
668get_next(void *next_cls,
669 int status)
670{
671 if (status != GNUNET_OK)
672 {
673 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
674 _("Failed to transmit an item to the client; aborting iteration.\n"));
675 if (plugin != NULL)
676 plugin->api->next_request (next_cls, GNUNET_YES);
677 return;
678 }
679 if (next_cls != NULL)
680 plugin->api->next_request (next_cls, GNUNET_NO);
681}
682
683 590
684/** 591/**
685 * Function that will transmit the given datastore entry 592 * Function that will transmit the given datastore entry
@@ -702,7 +609,6 @@ get_next(void *next_cls,
702 */ 609 */
703static int 610static int
704transmit_item (void *cls, 611transmit_item (void *cls,
705 void *next_cls,
706 const GNUNET_HashCode * key, 612 const GNUNET_HashCode * key,
707 uint32_t size, 613 uint32_t size,
708 const void *data, 614 const void *data,
@@ -727,10 +633,11 @@ transmit_item (void *cls,
727 end = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader)); 633 end = GNUNET_malloc (sizeof(struct GNUNET_MessageHeader));
728 end->size = htons(sizeof(struct GNUNET_MessageHeader)); 634 end->size = htons(sizeof(struct GNUNET_MessageHeader));
729 end->type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END); 635 end->type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END);
730 transmit (client, end, NULL, NULL, GNUNET_YES); 636 transmit (client, end);
731 GNUNET_SERVER_client_drop (client); 637 GNUNET_SERVER_client_drop (client);
732 return GNUNET_OK; 638 return GNUNET_OK;
733 } 639 }
640 GNUNET_assert (sizeof (struct DataMessage) + size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
734 dm = GNUNET_malloc (sizeof(struct DataMessage) + size); 641 dm = GNUNET_malloc (sizeof(struct DataMessage) + size);
735 dm->header.size = htons(sizeof(struct DataMessage) + size); 642 dm->header.size = htons(sizeof(struct DataMessage) + size);
736 dm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DATA); 643 dm->header.type = htons(GNUNET_MESSAGE_TYPE_DATASTORE_DATA);
@@ -754,8 +661,7 @@ transmit_item (void *cls,
754 gettext_noop ("# results found"), 661 gettext_noop ("# results found"),
755 1, 662 1,
756 GNUNET_NO); 663 GNUNET_NO);
757 transmit (client, &dm->header, &get_next, next_cls, 664 transmit (client, &dm->header);
758 (next_cls != NULL) ? GNUNET_NO : GNUNET_YES);
759 return GNUNET_OK; 665 return GNUNET_OK;
760} 666}
761 667
@@ -939,11 +845,6 @@ struct PutContext
939 * Client to notify on completion. 845 * Client to notify on completion.
940 */ 846 */
941 struct GNUNET_SERVER_Client *client; 847 struct GNUNET_SERVER_Client *client;
942
943 /**
944 * Did we find the data already in the database?
945 */
946 int is_present;
947 848
948 /* followed by the 'struct DataMessage' */ 849 /* followed by the 'struct DataMessage' */
949}; 850};
@@ -1009,7 +910,6 @@ execute_put (struct GNUNET_SERVER_Client *client,
1009 * matches the put and if none match executes the put. 910 * matches the put and if none match executes the put.
1010 * 911 *
1011 * @param cls closure, pointer to the client (of type 'struct PutContext'). 912 * @param cls closure, pointer to the client (of type 'struct PutContext').
1012 * @param next_cls closure to use to ask for the next item
1013 * @param key key for the content 913 * @param key key for the content
1014 * @param size number of bytes in data 914 * @param size number of bytes in data
1015 * @param data content stored 915 * @param data content stored
@@ -1020,12 +920,11 @@ execute_put (struct GNUNET_SERVER_Client *client,
1020 * @param uid unique identifier for the datum; 920 * @param uid unique identifier for the datum;
1021 * maybe 0 if no unique identifier is available 921 * maybe 0 if no unique identifier is available
1022 * 922 *
1023 * @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue, 923 * @return GNUNET_OK usually
1024 * GNUNET_NO to delete the item and continue (if supported) 924 * GNUNET_NO to delete the item
1025 */ 925 */
1026static int 926static int
1027check_present (void *cls, 927check_present (void *cls,
1028 void *next_cls,
1029 const GNUNET_HashCode * key, 928 const GNUNET_HashCode * key,
1030 uint32_t size, 929 uint32_t size,
1031 const void *data, 930 const void *data,
@@ -1041,13 +940,10 @@ check_present (void *cls,
1041 dm = (const struct DataMessage*) &pc[1]; 940 dm = (const struct DataMessage*) &pc[1];
1042 if (key == NULL) 941 if (key == NULL)
1043 { 942 {
1044 if (pc->is_present == GNUNET_YES) 943 execute_put (pc->client, dm);
1045 transmit_status (pc->client, GNUNET_NO, NULL);
1046 else
1047 execute_put (pc->client, dm);
1048 GNUNET_SERVER_client_drop (pc->client); 944 GNUNET_SERVER_client_drop (pc->client);
1049 GNUNET_free (pc); 945 GNUNET_free (pc);
1050 return GNUNET_SYSERR; 946 return GNUNET_OK;
1051 } 947 }
1052 if ( (GNUNET_BLOCK_TYPE_FS_DBLOCK == type) || 948 if ( (GNUNET_BLOCK_TYPE_FS_DBLOCK == type) ||
1053 (GNUNET_BLOCK_TYPE_FS_IBLOCK == type) || 949 (GNUNET_BLOCK_TYPE_FS_IBLOCK == type) ||
@@ -1056,12 +952,19 @@ check_present (void *cls,
1056 data, 952 data,
1057 size)) ) ) 953 size)) ) )
1058 { 954 {
1059 pc->is_present = GNUNET_YES; 955#if DEBUG_MYSQL
1060 plugin->api->next_request (next_cls, GNUNET_YES); 956 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
957 "Result already present in datastore\n");
958#endif
959 transmit_status (pc->client, GNUNET_NO, NULL);
960 GNUNET_SERVER_client_drop (pc->client);
961 GNUNET_free (pc);
1061 } 962 }
1062 else 963 else
1063 { 964 {
1064 plugin->api->next_request (next_cls, GNUNET_NO); 965 execute_put (pc->client, dm);
966 GNUNET_SERVER_client_drop (pc->client);
967 GNUNET_free (pc);
1065 } 968 }
1066 return GNUNET_OK; 969 return GNUNET_OK;
1067} 970}
@@ -1083,6 +986,7 @@ handle_put (void *cls,
1083 int rid; 986 int rid;
1084 struct ReservationList *pos; 987 struct ReservationList *pos;
1085 struct PutContext *pc; 988 struct PutContext *pc;
989 GNUNET_HashCode vhash;
1086 uint32_t size; 990 uint32_t size;
1087 991
1088 if ( (dm == NULL) || 992 if ( (dm == NULL) ||
@@ -1124,16 +1028,18 @@ handle_put (void *cls,
1124 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (filter, 1028 if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (filter,
1125 &dm->key)) 1029 &dm->key))
1126 { 1030 {
1031 GNUNET_CRYPTO_hash (&dm[1], size, &vhash);
1127 pc = GNUNET_malloc (sizeof (struct PutContext) + size + sizeof (struct DataMessage)); 1032 pc = GNUNET_malloc (sizeof (struct PutContext) + size + sizeof (struct DataMessage));
1128 pc->client = client; 1033 pc->client = client;
1129 GNUNET_SERVER_client_keep (client); 1034 GNUNET_SERVER_client_keep (client);
1130 memcpy (&pc[1], dm, size + sizeof (struct DataMessage)); 1035 memcpy (&pc[1], dm, size + sizeof (struct DataMessage));
1131 plugin->api->get (plugin->api->cls, 1036 plugin->api->get_key (plugin->api->cls,
1132 &dm->key, 1037 0,
1133 NULL, 1038 &dm->key,
1134 ntohl (dm->type), 1039 &vhash,
1135 &check_present, 1040 ntohl (dm->type),
1136 pc); 1041 &check_present,
1042 pc);
1137 return; 1043 return;
1138 } 1044 }
1139 execute_put (client, dm); 1045 execute_put (client, dm);
@@ -1192,16 +1098,17 @@ handle_get (void *cls,
1192 1, 1098 1,
1193 GNUNET_NO); 1099 GNUNET_NO);
1194 transmit_item (client, 1100 transmit_item (client,
1195 NULL, NULL, 0, NULL, 0, 0, 0, 1101 NULL, 0, NULL, 0, 0, 0,
1196 GNUNET_TIME_UNIT_ZERO_ABS, 0); 1102 GNUNET_TIME_UNIT_ZERO_ABS, 0);
1197 return; 1103 return;
1198 } 1104 }
1199 plugin->api->get (plugin->api->cls, 1105 plugin->api->get_key (plugin->api->cls,
1200 ((size == sizeof(struct GetMessage)) ? &msg->key : NULL), 1106 GNUNET_ntohll (msg->offset),
1201 NULL, 1107 ((size == sizeof(struct GetMessage)) ? &msg->key : NULL),
1202 ntohl(msg->type), 1108 NULL,
1203 &transmit_item, 1109 ntohl(msg->type),
1204 client); 1110 &transmit_item,
1111 client);
1205} 1112}
1206 1113
1207 1114
@@ -1265,7 +1172,7 @@ handle_get_replication (void *cls,
1265 1, 1172 1,
1266 GNUNET_NO); 1173 GNUNET_NO);
1267 GNUNET_SERVER_client_keep (client); 1174 GNUNET_SERVER_client_keep (client);
1268 plugin->api->replication_get (plugin->api->cls, 1175 plugin->api->get_replication (plugin->api->cls,
1269 &transmit_item, 1176 &transmit_item,
1270 client); 1177 client);
1271} 1178}
@@ -1303,37 +1210,20 @@ handle_get_zero_anonymity (void *cls,
1303 1, 1210 1,
1304 GNUNET_NO); 1211 GNUNET_NO);
1305 GNUNET_SERVER_client_keep (client); 1212 GNUNET_SERVER_client_keep (client);
1306 plugin->api->iter_zero_anonymity (plugin->api->cls, 1213 plugin->api->get_zero_anonymity (plugin->api->cls,
1307 type, 1214 GNUNET_ntohll (msg->offset),
1308 &transmit_item, 1215 type,
1309 client); 1216 &transmit_item,
1217 client);
1310} 1218}
1311 1219
1312 1220
1313/** 1221/**
1314 * Context for the 'remove_callback'.
1315 */
1316struct RemoveContext
1317{
1318 /**
1319 * Client for whom we're doing the remvoing.
1320 */
1321 struct GNUNET_SERVER_Client *client;
1322
1323 /**
1324 * GNUNET_YES if we managed to remove something.
1325 */
1326 int found;
1327};
1328
1329
1330/**
1331 * Callback function that will cause the item that is passed 1222 * Callback function that will cause the item that is passed
1332 * in to be deleted (by returning GNUNET_NO). 1223 * in to be deleted (by returning GNUNET_NO).
1333 */ 1224 */
1334static int 1225static int
1335remove_callback (void *cls, 1226remove_callback (void *cls,
1336 void *next_cls,
1337 const GNUNET_HashCode * key, 1227 const GNUNET_HashCode * key,
1338 uint32_t size, 1228 uint32_t size,
1339 const void *data, 1229 const void *data,
@@ -1343,7 +1233,7 @@ remove_callback (void *cls,
1343 struct GNUNET_TIME_Absolute 1233 struct GNUNET_TIME_Absolute
1344 expiration, uint64_t uid) 1234 expiration, uint64_t uid)
1345{ 1235{
1346 struct RemoveContext *rc = cls; 1236 struct GNUNET_SERVER_Client *client = cls;
1347 1237
1348 if (key == NULL) 1238 if (key == NULL)
1349 { 1239 {
@@ -1352,15 +1242,10 @@ remove_callback (void *cls,
1352 "No further matches for `%s' request.\n", 1242 "No further matches for `%s' request.\n",
1353 "REMOVE"); 1243 "REMOVE");
1354#endif 1244#endif
1355 if (GNUNET_YES == rc->found) 1245 transmit_status (client, GNUNET_NO, _("Content not found"));
1356 transmit_status (rc->client, GNUNET_OK, NULL); 1246 GNUNET_SERVER_client_drop (client);
1357 else
1358 transmit_status (rc->client, GNUNET_NO, _("Content not found"));
1359 GNUNET_SERVER_client_drop (rc->client);
1360 GNUNET_free (rc);
1361 return GNUNET_OK; /* last item */ 1247 return GNUNET_OK; /* last item */
1362 } 1248 }
1363 rc->found = GNUNET_YES;
1364#if DEBUG_DATASTORE 1249#if DEBUG_DATASTORE
1365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1250 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1366 "Item %llu matches `%s' request for key `%s' and type %u.\n", 1251 "Item %llu matches `%s' request for key `%s' and type %u.\n",
@@ -1375,7 +1260,8 @@ remove_callback (void *cls,
1375 GNUNET_YES); 1260 GNUNET_YES);
1376 GNUNET_CONTAINER_bloomfilter_remove (filter, 1261 GNUNET_CONTAINER_bloomfilter_remove (filter,
1377 key); 1262 key);
1378 plugin->api->next_request (next_cls, GNUNET_YES); 1263 transmit_status (client, GNUNET_OK, NULL);
1264 GNUNET_SERVER_client_drop (client);
1379 return GNUNET_NO; 1265 return GNUNET_NO;
1380} 1266}
1381 1267
@@ -1394,7 +1280,6 @@ handle_remove (void *cls,
1394{ 1280{
1395 const struct DataMessage *dm = check_data (message); 1281 const struct DataMessage *dm = check_data (message);
1396 GNUNET_HashCode vhash; 1282 GNUNET_HashCode vhash;
1397 struct RemoveContext *rc;
1398 1283
1399 if (dm == NULL) 1284 if (dm == NULL)
1400 { 1285 {
@@ -1413,18 +1298,17 @@ handle_remove (void *cls,
1413 gettext_noop ("# REMOVE requests received"), 1298 gettext_noop ("# REMOVE requests received"),
1414 1, 1299 1,
1415 GNUNET_NO); 1300 GNUNET_NO);
1416 rc = GNUNET_malloc (sizeof(struct RemoveContext));
1417 GNUNET_SERVER_client_keep (client); 1301 GNUNET_SERVER_client_keep (client);
1418 rc->client = client;
1419 GNUNET_CRYPTO_hash (&dm[1], 1302 GNUNET_CRYPTO_hash (&dm[1],
1420 ntohl(dm->size), 1303 ntohl(dm->size),
1421 &vhash); 1304 &vhash);
1422 plugin->api->get (plugin->api->cls, 1305 plugin->api->get_key (plugin->api->cls,
1423 &dm->key, 1306 0,
1424 &vhash, 1307 &dm->key,
1425 (enum GNUNET_BLOCK_Type) ntohl(dm->type), 1308 &vhash,
1426 &remove_callback, 1309 (enum GNUNET_BLOCK_Type) ntohl(dm->type),
1427 rc); 1310 &remove_callback,
1311 client);
1428} 1312}
1429 1313
1430 1314
@@ -1469,7 +1353,7 @@ disk_utilization_change_cb (void *cls,
1469 _("Datastore payload inaccurate (%lld < %lld). Trying to fix.\n"), 1353 _("Datastore payload inaccurate (%lld < %lld). Trying to fix.\n"),
1470 (long long) payload, 1354 (long long) payload,
1471 (long long) -delta); 1355 (long long) -delta);
1472 payload = plugin->api->get_size (plugin->api->cls); 1356 payload = plugin->api->estimate_size (plugin->api->cls);
1473 sync_stats (); 1357 sync_stats ();
1474 return; 1358 return;
1475 } 1359 }
@@ -1518,7 +1402,7 @@ process_stat_done (void *cls,
1518 1402
1519 stat_get = NULL; 1403 stat_get = NULL;
1520 if (stats_worked == GNUNET_NO) 1404 if (stats_worked == GNUNET_NO)
1521 payload = plugin->api->get_size (plugin->api->cls); 1405 payload = plugin->api->estimate_size (plugin->api->cls);
1522} 1406}
1523 1407
1524 1408
@@ -1636,8 +1520,6 @@ cleaning_task (void *cls,
1636 GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th); 1520 GNUNET_CONNECTION_notify_transmit_ready_cancel (tcc->th);
1637 GNUNET_SERVER_client_drop (tcc->client); 1521 GNUNET_SERVER_client_drop (tcc->client);
1638 } 1522 }
1639 if (NULL != tcc->tc)
1640 tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
1641 GNUNET_free (tcc->msg); 1523 GNUNET_free (tcc->msg);
1642 GNUNET_free (tcc); 1524 GNUNET_free (tcc);
1643 } 1525 }