mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-25 06:40:15 +00:00
added measure against half-flushed objects
This commit is contained in:
parent
600b33a230
commit
04aea6059e
@ -342,6 +342,7 @@ function handleCache(mode, versionString, cacheMode, callback) {
|
|||||||
path.dirname(versions[0].url);
|
path.dirname(versions[0].url);
|
||||||
|
|
||||||
var lastSizes = {};
|
var lastSizes = {};
|
||||||
|
var buf = "";
|
||||||
|
|
||||||
storageLoadingStart(versionString, cacheMode);
|
storageLoadingStart(versionString, cacheMode);
|
||||||
|
|
||||||
@ -349,12 +350,19 @@ function handleCache(mode, versionString, cacheMode, callback) {
|
|||||||
sock.setEncoding("utf8");
|
sock.setEncoding("utf8");
|
||||||
|
|
||||||
sock.on("data", function (data) {
|
sock.on("data", function (data) {
|
||||||
data.split("\n").forEach(function (sizeString) {
|
buf += data;
|
||||||
if (sizeString === "") return;
|
|
||||||
|
|
||||||
lastSizes = JSON.parse(sizeString);
|
var end = buf.indexOf("\n");
|
||||||
|
|
||||||
|
while (end > 0) {
|
||||||
|
var sub = buf.substring(0, end);
|
||||||
|
buf = buf.substring(end + 1);
|
||||||
|
|
||||||
|
lastSizes = JSON.parse(sub);
|
||||||
storageLoadingUpdate(lastSizes);
|
storageLoadingUpdate(lastSizes);
|
||||||
});
|
|
||||||
|
end = buf.indexOf("\n");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user