unsigned int left;
unsigned int todo;
unsigned int fit;
- int first_call;
unsigned int search_request_map_offset;
unsigned int keyword_offset;
+ int first_call;
memset (&mbc, 0, sizeof (mbc));
mbc.sc = sc;
if (GNUNET_FS_uri_test_ksk (sc->uri))
{
- mbc.put_cnt = 0;
+ /* This will calculate the result set size ONLY for
+ "keyword_offset == 0", so we will have to recalculate
+ it for the other keywords later! */
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&find_result_set,
&mbc);
}
search_request_map_offset = 0;
keyword_offset = 0;
-
first_call = GNUNET_YES;
while ( (0 != (left =
(total_seen_results - search_request_map_offset))) ||
GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
mbc.skip_cnt = search_request_map_offset;
mbc.xoff = (struct GNUNET_HashCode *) &sm[1];
+ sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK);
+ sm->anonymity_level = htonl (sc->anonymity);
+ memset (&sm->target,
+ 0,
+ sizeof (struct GNUNET_PeerIdentity));
if (GNUNET_FS_uri_test_ksk (sc->uri))
{
/* calculate how many results we can send in this message */
mbc.put_cnt = todo;
/* now build message */
- sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK);
- sm->anonymity_level = htonl (sc->anonymity);
- memset (&sm->target,
- 0,
- sizeof (struct GNUNET_PeerIdentity));
sm->query = sc->requests[keyword_offset].uquery;
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&build_result_set,
&mbc);
search_request_map_offset += todo;
- GNUNET_assert (0 == mbc.put_cnt); /* #4608 reports this fails? */
+ GNUNET_assert (0 == mbc.put_cnt);
GNUNET_assert (total_seen_results >= search_request_map_offset);
if (total_seen_results != search_request_map_offset)
{
{
sm->options = htonl (options);
keyword_offset++;
- search_request_map_offset = 0;
if (sc->uri->data.ksk.keywordCount != keyword_offset)
{
/* more keywords => more requesting to be done... */
first_call = GNUNET_YES;
+ search_request_map_offset = 0;
+ mbc.put_cnt = 0;
+ mbc.keyword_offset = keyword_offset;
+ GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
+ &find_result_set,
+ &mbc);
+ total_seen_results = mbc.put_cnt;
}
}
}
{
GNUNET_assert (GNUNET_FS_uri_test_sks (sc->uri));
- sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK);
- sm->anonymity_level = htonl (sc->anonymity);
- memset (&sm->target,
- 0,
- sizeof (struct GNUNET_PeerIdentity));
GNUNET_CRYPTO_ecdsa_public_key_derive (&sc->uri->data.sks.ns,
sc->uri->data.sks.identifier,
"fs-ublock",