mirror of
https://github.com/logos-messaging/negentropy.git
synced 2026-01-08 08:53:06 +00:00
remove std::reverse optimisation (wrong layer), bugfixes
This commit is contained in:
parent
2bcf2f2474
commit
275c6f3215
@ -97,7 +97,6 @@ struct Negentropy {
|
|||||||
void seal() {
|
void seal() {
|
||||||
if (sealed) throw negentropy::err("already sealed");
|
if (sealed) throw negentropy::err("already sealed");
|
||||||
|
|
||||||
std::reverse(items.begin(), items.end()); // typically pushed in approximately descending order so this may speed up the sort
|
|
||||||
std::sort(items.begin(), items.end());
|
std::sort(items.begin(), items.end());
|
||||||
sealed = true;
|
sealed = true;
|
||||||
}
|
}
|
||||||
@ -191,7 +190,7 @@ struct Negentropy {
|
|||||||
payload += encodeVarInt(responseHaveIds.size());
|
payload += encodeVarInt(responseHaveIds.size());
|
||||||
for (const auto &id : responseHaveIds) payload += id;
|
for (const auto &id : responseHaveIds) payload += id;
|
||||||
|
|
||||||
auto nextSplitBound = it >= upper ? currBound : getMinimalBound(*it, *std::next(it));
|
auto nextSplitBound = std::next(it) >= upper ? currBound : getMinimalBound(*it, *std::next(it));
|
||||||
|
|
||||||
outputs.emplace_back(BoundOutput({
|
outputs.emplace_back(BoundOutput({
|
||||||
didSplit ? splitBound : prevBound,
|
didSplit ? splitBound : prevBound,
|
||||||
@ -257,7 +256,7 @@ struct Negentropy {
|
|||||||
|
|
||||||
outputs.emplace_back(BoundOutput({
|
outputs.emplace_back(BoundOutput({
|
||||||
i == 0 ? lowerBound : prevBound,
|
i == 0 ? lowerBound : prevBound,
|
||||||
getMinimalBound(*std::prev(curr), *curr),
|
curr == items.end() ? upperBound : getMinimalBound(*std::prev(curr), *curr),
|
||||||
std::move(payload)
|
std::move(payload)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -294,9 +293,8 @@ struct Negentropy {
|
|||||||
if (frameSizeLimit && output.size() + o.size() > frameSizeLimit - 5) break; // 5 leaves room for Continuation
|
if (frameSizeLimit && output.size() + o.size() > frameSizeLimit - 5) break; // 5 leaves room for Continuation
|
||||||
output += o;
|
output += o;
|
||||||
|
|
||||||
pendingOutputs.pop_front();
|
|
||||||
|
|
||||||
currBound = p.end;
|
currBound = p.end;
|
||||||
|
pendingOutputs.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server indicates that it has more to send, OR ensure client sends a non-empty message
|
// Server indicates that it has more to send, OR ensure client sends a non-empty message
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user