fix(replication): fix replication on some cases of downloading

This commit is contained in:
Alexey Kasyanchuk 2018-06-27 23:49:41 +03:00
parent 545f772918
commit 72828b860f
2 changed files with 6 additions and 1 deletions

View File

@ -136,6 +136,7 @@ module.exports = async ({
const peer = p2p.find(options.peer) const peer = p2p.find(options.peer)
if(!peer) if(!peer)
{ {
console.log('dont found requested peer in peers')
callback(undefined) callback(undefined)
return; return;
} }
@ -532,7 +533,7 @@ module.exports = async ({
const peer = { address: socket.remoteAddress, port: socket.remotePort } const peer = { address: socket.remoteAddress, port: socket.remotePort }
remote = remote.map(torrent => Object.assign(torrent, {peer})) remote = remote.map(torrent => Object.assign(torrent, {peer}))
} }
send('remoteTopTorrents', {torrents: remote, type, time: navigation && navigation.time}) send('remoteTopTorrents', {torrents: mergeTorrentsWithDownloads(remote), type, time: navigation && navigation.time})
}) })
})); }));

View File

@ -456,6 +456,10 @@ setInterval(() => {
delete torrent.contenttype; delete torrent.contenttype;
} }
// clean download info if added
if(torrent.download)
delete torrent.download
if(!checkTorrent(torrent)) if(!checkTorrent(torrent))
{ {
resolve() resolve()