mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-22 07:46:17 -04:00
Fix _fileReceived getting called twice
This commit is contained in:
parent
aacf24c31f
commit
90f10910aa
1 changed files with 6 additions and 6 deletions
|
@ -878,7 +878,7 @@ class Peer {
|
|||
this._sendMessage({ type: 'receive-progress', progress: progress });
|
||||
}
|
||||
|
||||
async _fileReceived(file) {
|
||||
_fileReceived(file) {
|
||||
// File transfer complete
|
||||
this._singleFileReceiveComplete(file);
|
||||
|
||||
|
@ -912,7 +912,10 @@ class Peer {
|
|||
}
|
||||
|
||||
_singleFileReceiveComplete(file) {
|
||||
this._digester._fileCompleteCallback = null;
|
||||
this._digester._sendReceiveConfimationCallback = null;
|
||||
this._digester = null;
|
||||
|
||||
this._totalBytesReceived += file.size;
|
||||
|
||||
const duration = (Date.now() - this._timeStart) / 1000; // s
|
||||
|
@ -1894,9 +1897,6 @@ class FileDigester {
|
|||
}
|
||||
|
||||
function onPart(part) {
|
||||
// remove old chunk from buffer
|
||||
_this._buffer[i] = null;
|
||||
|
||||
if (i < _this._buffer.length - 1) {
|
||||
// process next chunk
|
||||
offset += part.byteLength;
|
||||
|
@ -1925,9 +1925,9 @@ class FileDigester {
|
|||
Logger.error(error);
|
||||
Logger.warn('Failed to process file via service-worker. Do not use Firefox private mode to prevent this.')
|
||||
|
||||
// Use memory method instead and tidy up.
|
||||
_this.processFileViaMemory();
|
||||
// Use memory method instead and terminate service worker.
|
||||
fileWorker.terminate();
|
||||
_this.processFileViaMemory();
|
||||
}
|
||||
|
||||
sendPart(this._buffer[i], offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue