diff options
Diffstat (limited to 'src/credential/gnunet-service-credential.c')
-rw-r--r-- | src/credential/gnunet-service-credential.c | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 5ce0f70d9..daffc0bb9 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -429,26 +429,28 @@ cleanup_handle (struct VerifyRequestHandle *vrh) | |||
429 | struct DelegateRecordEntry *del_entry; | 429 | struct DelegateRecordEntry *del_entry; |
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); | 430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); |
431 | 431 | ||
432 | if (NULL == vrh->dsq_head) | 432 | if (NULL != vrh->dsq_head) |
433 | return; | ||
434 | |||
435 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != vrh->dsq_head; | ||
436 | ds_entry = vrh->dsq_head) | ||
437 | { | 433 | { |
438 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); | 434 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != vrh->dsq_head; |
439 | cleanup_dsq_entry(ds_entry); | 435 | ds_entry = vrh->dsq_head) |
436 | { | ||
437 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); | ||
438 | cleanup_dsq_entry(ds_entry); | ||
439 | } | ||
440 | } | 440 | } |
441 | 441 | if (NULL != vrh->del_chain_head) | |
442 | GNUNET_free_non_null (vrh->issuer_attribute); | ||
443 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; | ||
444 | del_entry = vrh->del_chain_head) | ||
445 | { | 442 | { |
446 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, | 443 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; |
447 | vrh->del_chain_tail, | 444 | del_entry = vrh->del_chain_head) |
448 | del_entry); | 445 | { |
449 | GNUNET_free_non_null (del_entry->delegate); | 446 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, |
450 | GNUNET_free (del_entry); | 447 | vrh->del_chain_tail, |
448 | del_entry); | ||
449 | GNUNET_free_non_null (del_entry->delegate); | ||
450 | GNUNET_free (del_entry); | ||
451 | } | ||
451 | } | 452 | } |
453 | GNUNET_free_non_null (vrh->issuer_attribute); | ||
452 | GNUNET_free (vrh); | 454 | GNUNET_free (vrh); |
453 | } | 455 | } |
454 | 456 | ||
@@ -622,7 +624,6 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
622 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 624 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); |
623 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 625 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); |
624 | cleanup_handle (vrh); | 626 | cleanup_handle (vrh); |
625 | |||
626 | GNUNET_STATISTICS_update (statistics, | 627 | GNUNET_STATISTICS_update (statistics, |
627 | "Completed verifications", | 628 | "Completed verifications", |
628 | 1, | 629 | 1, |
@@ -1217,7 +1218,7 @@ backward_resolution (void *cls, | |||
1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1218 | "%s still to go...\n", | 1219 | "%s still to go...\n", |
1219 | ds_entry->attr_trailer); | 1220 | ds_entry->attr_trailer); |
1220 | // TODO remove | 1221 | |
1221 | vrh->pending_lookups++; | 1222 | vrh->pending_lookups++; |
1222 | ds_entry->handle = vrh; | 1223 | ds_entry->handle = vrh; |
1223 | ds_entry->lookup_request = | 1224 | ds_entry->lookup_request = |
@@ -1247,9 +1248,11 @@ backward_resolution (void *cls, | |||
1247 | * | 1248 | * |
1248 | * @param cls the closure (our client lookup handle) | 1249 | * @param cls the closure (our client lookup handle) |
1249 | */ | 1250 | */ |
1250 | static void | 1251 | static int |
1251 | delegation_chain_bw_resolution_start (void *cls) | 1252 | delegation_chain_bw_resolution_start (void *cls) |
1252 | { | 1253 | { |
1254 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Start Backward Resolution...\n"); | ||
1255 | |||
1253 | struct VerifyRequestHandle *vrh = cls; | 1256 | struct VerifyRequestHandle *vrh = cls; |
1254 | struct DelegationSetQueueEntry *ds_entry; | 1257 | struct DelegationSetQueueEntry *ds_entry; |
1255 | struct DelegateRecordEntry *del_entry; | 1258 | struct DelegateRecordEntry *del_entry; |
@@ -1258,7 +1261,7 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1258 | { | 1261 | { |
1259 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegates found\n"); | 1262 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegates found\n"); |
1260 | send_lookup_response (vrh); | 1263 | send_lookup_response (vrh); |
1261 | return; | 1264 | return 2; |
1262 | } | 1265 | } |
1263 | 1266 | ||
1264 | // Pre-check with vrh->dele_chain_.. if match issuer_key | 1267 | // Pre-check with vrh->dele_chain_.. if match issuer_key |
@@ -1281,7 +1284,7 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1281 | del_entry->refcount++; | 1284 | del_entry->refcount++; |
1282 | // Found match prematurely | 1285 | // Found match prematurely |
1283 | send_lookup_response (vrh); | 1286 | send_lookup_response (vrh); |
1284 | return; | 1287 | return 1; |
1285 | } | 1288 | } |
1286 | 1289 | ||
1287 | 1290 | ||
@@ -1321,11 +1324,14 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1321 | GNUNET_GNS_LO_DEFAULT, | 1324 | GNUNET_GNS_LO_DEFAULT, |
1322 | &backward_resolution, | 1325 | &backward_resolution, |
1323 | ds_entry); | 1326 | ds_entry); |
1327 | return 0; | ||
1324 | } | 1328 | } |
1325 | 1329 | ||
1326 | static void | 1330 | static int |
1327 | delegation_chain_fw_resolution_start (void *cls) | 1331 | delegation_chain_fw_resolution_start (void *cls) |
1328 | { | 1332 | { |
1333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Start Forward Resolution...\n"); | ||
1334 | |||
1329 | struct VerifyRequestHandle *vrh = cls; | 1335 | struct VerifyRequestHandle *vrh = cls; |
1330 | struct DelegationSetQueueEntry *ds_entry; | 1336 | struct DelegationSetQueueEntry *ds_entry; |
1331 | struct DelegateRecordEntry *del_entry; | 1337 | struct DelegateRecordEntry *del_entry; |
@@ -1337,7 +1343,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1337 | { | 1343 | { |
1338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegations found\n"); | 1344 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegations found\n"); |
1339 | send_lookup_response (vrh); | 1345 | send_lookup_response (vrh); |
1340 | return; | 1346 | return 2; |
1341 | } | 1347 | } |
1342 | 1348 | ||
1343 | // Pre-check with vrh->dele_chain_.. if match issuer_key | 1349 | // Pre-check with vrh->dele_chain_.. if match issuer_key |
@@ -1359,7 +1365,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1359 | del_entry->refcount++; | 1365 | del_entry->refcount++; |
1360 | // Found match prematurely | 1366 | // Found match prematurely |
1361 | send_lookup_response (vrh); | 1367 | send_lookup_response (vrh); |
1362 | return; | 1368 | return 1; |
1363 | } | 1369 | } |
1364 | 1370 | ||
1365 | // None match, therefore start for every delegation found a lookup chain | 1371 | // None match, therefore start for every delegation found a lookup chain |
@@ -1409,6 +1415,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1409 | &forward_resolution, | 1415 | &forward_resolution, |
1410 | ds_entry); | 1416 | ds_entry); |
1411 | } | 1417 | } |
1418 | return 0; | ||
1412 | } | 1419 | } |
1413 | 1420 | ||
1414 | static int | 1421 | static int |
@@ -1528,7 +1535,8 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1528 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && | 1535 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && |
1529 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) | 1536 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) |
1530 | { | 1537 | { |
1531 | delegation_chain_fw_resolution_start (vrh); | 1538 | if(1 == delegation_chain_fw_resolution_start (vrh)) |
1539 | return; | ||
1532 | delegation_chain_bw_resolution_start (vrh); | 1540 | delegation_chain_bw_resolution_start (vrh); |
1533 | } | 1541 | } |
1534 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1542 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) |
@@ -1561,7 +1569,9 @@ delegate_collection_finished (void *cls) | |||
1561 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && | 1569 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && |
1562 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) | 1570 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) |
1563 | { | 1571 | { |
1564 | delegation_chain_fw_resolution_start (vrh); | 1572 | // if premature match found don't start bw resultion |
1573 | if(1 == delegation_chain_fw_resolution_start (vrh)) | ||
1574 | return; | ||
1565 | delegation_chain_bw_resolution_start (vrh); | 1575 | delegation_chain_bw_resolution_start (vrh); |
1566 | } | 1576 | } |
1567 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1577 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) |