diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-29 17:51:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-29 17:51:49 +0000 |
commit | a8e90a359a36b28bc73bd3709332cef607d139fa (patch) | |
tree | 587f60f42c4a21155a80cded9f349f6c95f91457 /src/fs/fs_search.c | |
parent | 481d9421fcb761679daea807e94dd147d35ea7a0 (diff) | |
download | gnunet-a8e90a359a36b28bc73bd3709332cef607d139fa.tar.gz gnunet-a8e90a359a36b28bc73bd3709332cef607d139fa.zip |
fixes
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r-- | src/fs/fs_search.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 746a2f19d..3b90338af 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -438,7 +438,7 @@ process_sblock (struct GNUNET_FS_SearchContext *sc, | |||
438 | strlen (identifier), | 438 | strlen (identifier), |
439 | &key); | 439 | &key); |
440 | GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv); | 440 | GNUNET_CRYPTO_hash_to_aes_key (&key, &skey, &iv); |
441 | GNUNET_CRYPTO_aes_encrypt (&sb[1], | 441 | GNUNET_CRYPTO_aes_decrypt (&sb[1], |
442 | len, | 442 | len, |
443 | &skey, | 443 | &skey, |
444 | &iv, | 444 | &iv, |
@@ -464,6 +464,9 @@ process_sblock (struct GNUNET_FS_SearchContext *sc, | |||
464 | uri = GNUNET_FS_uri_parse (uris, &emsg); | 464 | uri = GNUNET_FS_uri_parse (uris, &emsg); |
465 | if (uri == NULL) | 465 | if (uri == NULL) |
466 | { | 466 | { |
467 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
468 | "Failed to parse URI `%s': %s\n", | ||
469 | uris, emsg); | ||
467 | GNUNET_break_op (0); /* sblock malformed */ | 470 | GNUNET_break_op (0); /* sblock malformed */ |
468 | GNUNET_free_non_null (emsg); | 471 | GNUNET_free_non_null (emsg); |
469 | GNUNET_CONTAINER_meta_data_destroy (meta); | 472 | GNUNET_CONTAINER_meta_data_destroy (meta); |
@@ -494,7 +497,11 @@ process_result (struct GNUNET_FS_SearchContext *sc, | |||
494 | size_t size) | 497 | size_t size) |
495 | { | 498 | { |
496 | if (GNUNET_TIME_absolute_get_duration (expiration).value > 0) | 499 | if (GNUNET_TIME_absolute_get_duration (expiration).value > 0) |
497 | return; /* result expired */ | 500 | { |
501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
502 | "Result received has already expired.\n"); | ||
503 | return; /* result expired */ | ||
504 | } | ||
498 | switch (type) | 505 | switch (type) |
499 | { | 506 | { |
500 | case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK: | 507 | case GNUNET_DATASTORE_BLOCKTYPE_KBLOCK: |
@@ -511,7 +518,7 @@ process_result (struct GNUNET_FS_SearchContext *sc, | |||
511 | process_kblock (sc, data, size); | 518 | process_kblock (sc, data, size); |
512 | break; | 519 | break; |
513 | case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK: | 520 | case GNUNET_DATASTORE_BLOCKTYPE_SBLOCK: |
514 | if (! GNUNET_FS_uri_test_ksk (sc->uri)) | 521 | if (! GNUNET_FS_uri_test_sks (sc->uri)) |
515 | { | 522 | { |
516 | GNUNET_break (0); | 523 | GNUNET_break (0); |
517 | return; | 524 | return; |
@@ -572,6 +579,9 @@ receive_results (void *cls, | |||
572 | return; | 579 | return; |
573 | } | 580 | } |
574 | msize = ntohs (msg->size); | 581 | msize = ntohs (msg->size); |
582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
583 | "Receiving %u bytes of result from fs service\n", | ||
584 | msize); | ||
575 | cm = (const struct PutMessage*) msg; | 585 | cm = (const struct PutMessage*) msg; |
576 | process_result (sc, | 586 | process_result (sc, |
577 | ntohl (cm->type), | 587 | ntohl (cm->type), |
@@ -624,7 +634,7 @@ transmit_search_request (void *cls, | |||
624 | sm[i].header.size = htons (sizeof (struct SearchMessage)); | 634 | sm[i].header.size = htons (sizeof (struct SearchMessage)); |
625 | sm[i].header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH); | 635 | sm[i].header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH); |
626 | sm[i].type = htonl (GNUNET_DATASTORE_BLOCKTYPE_KBLOCK); | 636 | sm[i].type = htonl (GNUNET_DATASTORE_BLOCKTYPE_KBLOCK); |
627 | sm[i].anonymity_level = htonl (sc->anonymity); | 637 | sm[i].anonymity_level = htonl (sc->anonymity); |
628 | sm[i].query = sc->requests[i].query; | 638 | sm[i].query = sc->requests[i].query; |
629 | } | 639 | } |
630 | } | 640 | } |
@@ -966,8 +976,12 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) | |||
966 | if (NULL != sc->client) | 976 | if (NULL != sc->client) |
967 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); | 977 | GNUNET_CLIENT_disconnect (sc->client, GNUNET_NO); |
968 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); | 978 | GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); |
969 | for (i=0;i<sc->uri->data.ksk.keywordCount;i++) | 979 | if (sc->requests != NULL) |
970 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); | 980 | { |
981 | GNUNET_assert (GNUNET_FS_uri_test_ksk (sc->uri)); | ||
982 | for (i=0;i<sc->uri->data.ksk.keywordCount;i++) | ||
983 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); | ||
984 | } | ||
971 | GNUNET_free_non_null (sc->requests); | 985 | GNUNET_free_non_null (sc->requests); |
972 | GNUNET_FS_uri_destroy (sc->uri); | 986 | GNUNET_FS_uri_destroy (sc->uri); |
973 | GNUNET_free (sc); | 987 | GNUNET_free (sc); |