feat(p2p): app version on p2p
This commit is contained in:
parent
9224da808e
commit
6a63bc626d
@ -362,7 +362,7 @@ app.on("ready", () => {
|
||||
}
|
||||
callback.apply(null, arg)
|
||||
})
|
||||
}, app.getPath("userData"))
|
||||
}, app.getPath("userData"), app.getVersion())
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -12,6 +12,7 @@ class p2p {
|
||||
externalPeers = []
|
||||
size = 0
|
||||
p2pStatus = 0
|
||||
version = '0'
|
||||
|
||||
constructor(send = () => {})
|
||||
{
|
||||
@ -53,6 +54,7 @@ class p2p {
|
||||
|
||||
callback({
|
||||
protocol: 'rats',
|
||||
version: this.version,
|
||||
peers: this.peersList().slice(0, 4).map(peer => ({address: peer.address, port: peer.port}))
|
||||
})
|
||||
|
||||
@ -224,6 +226,7 @@ class p2p {
|
||||
emit('protocol', {
|
||||
protocol: 'rats',
|
||||
port: config.spiderPort,
|
||||
version: this.version,
|
||||
peers: this.peersList().slice(0, 4).map(peer => ({address: peer.address, port: peer.port})).concat(this.externalPeers) // also add external peers
|
||||
}, (data) => {
|
||||
if(!data || data.protocol != 'rats')
|
||||
|
@ -37,7 +37,7 @@ const torrentClient = require('./torrentClient')
|
||||
//server.listen(config.httpPort);
|
||||
//console.log('Listening web server on', config.httpPort, 'port')
|
||||
|
||||
module.exports = function (send, recive, dataDirectory)
|
||||
module.exports = function (send, recive, dataDirectory, version)
|
||||
{
|
||||
|
||||
let torrentsId = 1;
|
||||
@ -253,6 +253,7 @@ function baseRowData(row)
|
||||
}
|
||||
|
||||
const p2p = new P2PServer(send)
|
||||
p2p.version = version
|
||||
p2p.encryptor = encryptor
|
||||
p2p.listen()
|
||||
// load initial peers
|
||||
|
Loading…
Reference in New Issue
Block a user