diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-07 21:00:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-07 21:00:13 +0000 |
commit | 948fa9a6942b2a4a10a8916f36bcd506cccb6aa2 (patch) | |
tree | 845b3d094b9d98c999f6ad17d6cfa71bc8bd87f8 /src/fs/fs_download.c | |
parent | a29e1679c9a836169a77882541b04e7ba065a0d3 (diff) | |
download | gnunet-948fa9a6942b2a4a10a8916f36bcd506cccb6aa2.tar.gz gnunet-948fa9a6942b2a4a10a8916f36bcd506cccb6aa2.zip |
-more chk index calculation errors, ugh
Diffstat (limited to 'src/fs/fs_download.c')
-rw-r--r-- | src/fs/fs_download.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 11f5db5b2..f858c58bf 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1531,23 +1531,23 @@ create_download_request (struct DownloadRequest *parent, | |||
1531 | if (dr_offset < file_start_offset) | 1531 | if (dr_offset < file_start_offset) |
1532 | head_skip = file_start_offset / child_block_size; | 1532 | head_skip = file_start_offset / child_block_size; |
1533 | else | 1533 | else |
1534 | head_skip = dr_offset / child_block_size; | 1534 | head_skip = 0; |
1535 | 1535 | ||
1536 | /* calculate index of last block at this level that is interesting (rounded up) */ | 1536 | /* calculate index of last block at this level that is interesting (rounded up) */ |
1537 | dr->num_children = (file_start_offset + desired_length) / child_block_size; | 1537 | dr->num_children = (file_start_offset + desired_length - dr_offset) / child_block_size; |
1538 | if (dr->num_children * child_block_size < | 1538 | if (dr->num_children * child_block_size < |
1539 | file_start_offset + desired_length) | 1539 | file_start_offset + desired_length - dr_offset) |
1540 | dr->num_children++; /* round up */ | 1540 | dr->num_children++; /* round up */ |
1541 | if (dr->num_children > CHK_PER_INODE) | ||
1542 | dr->num_children = CHK_PER_INODE; /* cap at max */ | ||
1541 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1542 | "Block at offset %llu and depth %u has %u children\n", | 1544 | "Block at offset %llu and depth %u has %u children\n", |
1543 | (unsigned long long) dr_offset, | 1545 | (unsigned long long) dr_offset, |
1544 | depth, | 1546 | depth, |
1545 | dr->num_children); | 1547 | dr->num_children); |
1546 | 1548 | ||
1547 | /* now we can get the total number of children for this block */ | 1549 | /* now we can get the total number of *interesting* children for this block */ |
1548 | dr->num_children -= head_skip; | 1550 | dr->num_children -= head_skip; |
1549 | if (dr->num_children > CHK_PER_INODE) | ||
1550 | dr->num_children = CHK_PER_INODE; /* cap at max */ | ||
1551 | 1551 | ||
1552 | /* why else would we have gotten here to begin with? (that'd be a bad logic error) */ | 1552 | /* why else would we have gotten here to begin with? (that'd be a bad logic error) */ |
1553 | GNUNET_assert (dr->num_children > 0); | 1553 | GNUNET_assert (dr->num_children > 0); |