aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Database.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Database.cpp b/src/Database.cpp
index 3f5ae2f..169c066 100644
--- a/src/Database.cpp
+++ b/src/Database.cpp
@@ -234,17 +234,20 @@ namespace odhtdb
});
}
+ vector<unique_ptr<u8[]>> userPublicKeys;
+
// TODO(Performance improvement): Sort actions by gap start and do a binary search to check if raw data is the packet the peer wants
DataViewMap<vector<ActionGap>> actionGaps;
while(!deserializer.empty())
{
- u8 userPublicKeyRaw[PUBLIC_KEY_NUM_BYTES];
- deserializer.extract(userPublicKeyRaw, PUBLIC_KEY_NUM_BYTES);
+ unique_ptr<u8[]> userPublicKeyRaw(new u8[PUBLIC_KEY_NUM_BYTES]);
+ deserializer.extract(userPublicKeyRaw.get(), PUBLIC_KEY_NUM_BYTES);
u64 actionGapStart = deserializer.extract<u64>();
u64 actionGapRange = deserializer.extract<u64>();
- DataView userPublicKey(userPublicKeyRaw, PUBLIC_KEY_NUM_BYTES);
+ DataView userPublicKey(userPublicKeyRaw.get(), PUBLIC_KEY_NUM_BYTES);
actionGaps[userPublicKey].push_back({ actionGapStart, actionGapRange });
+ userPublicKeys.emplace_back(move(userPublicKeyRaw));
}
if(actionGaps.empty())