Skip to content

Commit

Permalink
Add TODO to update nodekeys
Browse files Browse the repository at this point in the history
The update of nodekeys requires API changes, so it will be address in a
near future, in a different branch.
  • Loading branch information
sergiohs84 committed Nov 17, 2020
1 parent 76193f9 commit 37b346c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
1 change: 0 additions & 1 deletion include/mega/transferslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ struct MEGA_API TransferSlot
bool tryRaidRecoveryFromHttpGetError(unsigned i);
bool checkDownloadTransferFinished(DBTableTransactionCommitter& committer, MegaClient* client);
bool checkMetaMacWithMissingLateEntries();
void updateMacInKey(int64_t correctMac);
};
} // namespace

Expand Down
33 changes: 2 additions & 31 deletions src/transferslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ bool TransferSlot::checkMetaMacWithMissingLateEntries()
auto correctMac = macsmac(&transfer->chunkmacs);
transfer->currentmetamac = correctMac;
transfer->metamac = correctMac;
updateMacInKey(correctMac);
// TODO: update the Node's key to be correct (needs some API additions before enabling)
return true;
}
}
Expand All @@ -394,7 +394,7 @@ bool TransferSlot::checkMetaMacWithMissingLateEntries()
auto correctMac = macsmac(&transfer->chunkmacs);
transfer->currentmetamac = correctMac;
transfer->metamac = correctMac;
updateMacInKey(correctMac);
// TODO: update the Node's key to be correct (needs some API additions before enabling)
return true;
}
}
Expand All @@ -404,35 +404,6 @@ bool TransferSlot::checkMetaMacWithMissingLateEntries()
return false;
}

void TransferSlot::updateMacInKey(int64_t correctMac)
{
// Update the Node's key to be correct (needs some API additions before enabling)
//for (file_list::iterator it = transfer->files.begin(); it != transfer->files.end(); it++)
//{
// if ((*it)->hprivate && !(*it)->hforeign)
// {
// if (Node* n = transfer->client->nodebyhandle((*it)->h))
// {
// if (n->type == FILENODE && n->nodekey().size() == FILENODEKEYLENGTH)
// {
// auto k1 = (byte*)n->nodekey().data();
// auto k2 = k1 + SymmCipher::KEYLENGTH;
// if (transfer->metamac == MemAccess::get<int64_t>((const char*)k2 + sizeof(int64_t)))
// {
// SymmCipher::xorblock(k2, k1);
// MemAccess::set<int64_t>(k2 + sizeof(int64_t), correctMac);
// SymmCipher::xorblock(k2, k1);

// handle_vector hv;
// hv.push_back(n->nodehandle);
// transfer->client->reqs.add(new CommandNodeKeyUpdate(transfer->client, &hv));
// }
// }
// }
// }
//}
}

bool TransferSlot::checkDownloadTransferFinished(DBTableTransactionCommitter& committer, MegaClient* client)
{
if (transfer->progresscompleted == transfer->size)
Expand Down

0 comments on commit 37b346c

Please sign in to comment.