@deadlock-delegate/crawler
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -70,3 +70,3 @@ const Crawler = require('./src/crawler') | ||
const node = { ip: undefined, port: undefined } | ||
if (args.length === 1) { | ||
if (args.length >= 1) { | ||
const url = new URL(args[0]) | ||
@@ -73,0 +73,0 @@ node.ip = url.hostname |
# Changelog | ||
## [1.4.5] - 2020-10-24 | ||
- handle socket onDisconnect | ||
## [1.4.4] - 2020-10-17 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@deadlock-delegate/crawler", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "Crawler scans the ARK network to get information about the peers in the network.", | ||
@@ -5,0 +5,0 @@ "main": "src/crawler.js", |
const Client = require('./client') | ||
class Peers { | ||
constructor (timeout = 10) { | ||
constructor (timeout = 2500) { | ||
this.timeout = timeout | ||
@@ -22,6 +22,12 @@ this.connections = new Map() | ||
connection.onDisconnect = () => { | ||
console.debug(` Socket disconnected (peer ${ip})`) | ||
this.disconnect(ip); | ||
} | ||
try { | ||
await connection.connect({ retries: 1, timeout: this.timeout }) | ||
await connection.connect({ retries: 1, timeout: this.timeout }); | ||
} catch (err) { | ||
console.log(` There was a problem connecting to`, ip) | ||
return | ||
} | ||
@@ -51,2 +57,3 @@ | ||
console.log(` Error disconnecting from ${ip}: ${err}`) | ||
return | ||
} | ||
@@ -53,0 +60,0 @@ this.connections.delete(ip) |
26737
700