Fixed incorrect progress for downloading

This commit is contained in:
MysterD 2022-04-11 19:34:28 -07:00
parent 456da82f2f
commit 77bace907c
1 changed files with 6 additions and 0 deletions

View File

@ -280,6 +280,7 @@ void network_receive_download(struct Packet* p) {
packet_read(p, &chunk, sizeof(u8) * chunkLength); packet_read(p, &chunk, sizeof(u8) * chunkLength);
// mark the offset group as received // mark the offset group as received
bool foundGroup = false;
for (u64 i = 0; i < 2; i++) { for (u64 i = 0; i < 2; i++) {
struct OffsetGroup* og = &sOffsetGroup[i]; struct OffsetGroup* og = &sOffsetGroup[i];
for (u64 j = 0; j < OFFSET_COUNT; j++) { for (u64 j = 0; j < OFFSET_COUNT; j++) {
@ -296,6 +297,11 @@ void network_receive_download(struct Packet* p) {
} }
after_group:; after_group:;
if (!foundGroup) {
LOG_INFO("Received chunk from an inactive offset group");
return;
}
// write the chunk // write the chunk
u64 chunkPour = 0; u64 chunkPour = 0;
u64 fileStartOffset = 0; u64 fileStartOffset = 0;