mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-17 08:48:51 +00:00
sync improvements and incompatible upgrade
* New Negentropy protocol: Syncs with older versions of strfry will break (sorry!) * Bi-directional frame size limits: fixes a bug when syncing very large DBs where the client side was near empty * sync command now politely tells server it can release Negentropy resources as soon as reconcile complete
This commit is contained in:
2
external/negentropy
vendored
2
external/negentropy
vendored
Submodule external/negentropy updated: a1b6eed1a4...af0b3d7874
@ -48,7 +48,7 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
|||||||
tao::json::value filter = tao::json::from_string(filterStr);
|
tao::json::value filter = tao::json::from_string(filterStr);
|
||||||
|
|
||||||
|
|
||||||
Negentropy ne(idSize);
|
Negentropy ne(idSize, frameSizeLimit);
|
||||||
|
|
||||||
{
|
{
|
||||||
DBQuery query(filter);
|
DBQuery query(filter);
|
||||||
@ -90,7 +90,7 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
|||||||
ws.reconnect = false;
|
ws.reconnect = false;
|
||||||
|
|
||||||
ws.onConnect = [&]{
|
ws.onConnect = [&]{
|
||||||
auto neMsg = to_hex(ne.initiate(frameSizeLimit));
|
auto neMsg = to_hex(ne.initiate());
|
||||||
ws.send(tao::json::to_string(tao::json::value::array({
|
ws.send(tao::json::to_string(tao::json::value::array({
|
||||||
"NEG-OPEN",
|
"NEG-OPEN",
|
||||||
"N",
|
"N",
|
||||||
@ -137,6 +137,11 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
|||||||
if (neMsg.size() == 0) {
|
if (neMsg.size() == 0) {
|
||||||
syncDone = true;
|
syncDone = true;
|
||||||
LI << "Set reconcile complete. Have " << totalHaves << " need " << totalNeeds;
|
LI << "Set reconcile complete. Have " << totalHaves << " need " << totalNeeds;
|
||||||
|
|
||||||
|
ws.send(tao::json::to_string(tao::json::value::array({
|
||||||
|
"NEG-CLOSE",
|
||||||
|
"N",
|
||||||
|
})));
|
||||||
} else {
|
} else {
|
||||||
ws.send(tao::json::to_string(tao::json::value::array({
|
ws.send(tao::json::to_string(tao::json::value::array({
|
||||||
"NEG-MSG",
|
"NEG-MSG",
|
||||||
|
@ -28,7 +28,7 @@ struct NegentropyViews {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connViews.try_emplace(subId, UserView{ Negentropy(idSize), initialMsg });
|
connViews.try_emplace(subId, UserView{ Negentropy(idSize, 500'000), initialMsg });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user