summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/importer.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/www/js/importer.js b/www/js/importer.js
index dd8913f..1da9d1a 100644
--- a/www/js/importer.js
+++ b/www/js/importer.js
@@ -374,18 +374,21 @@ Rdxport.Upload.prototype.onmessage = function(event) {
var end = chunkSize;
var self = this;
var interval = setInterval(function() {
- if (self.webSocket.bufferedAmount > 4 * chunkSize) {
- return true;
- }
- var blob = self.file.slice(start, end, {type: "application/octet-stream"});
- self.webSocket.send(blob);
+ for(var i = 0; i < 16; i++) {
+ if (self.webSocket.bufferedAmount > 16 * chunkSize) {
+ return true;
+ }
+ var blob = self.file.slice(start, end, {type: "application/octet-stream"});
+ self.webSocket.send(blob);
- if (self.file.size === end) {
- clearInterval(interval);
+ if (self.file.size === end) {
+ clearInterval(interval);
+ return true;
+ }
+ start += chunkSize;
+ end += chunkSize;
+ end = end > self.file.size ? self.file.size : end;
}
- start += chunkSize;
- end += chunkSize;
- end = end > self.file.size ? self.file.size : end;
}, 10);
}
};