Skip to content

Commit

Permalink
fix(p2p): errors on peers ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Feb 21, 2018
1 parent e7b30ab commit 4b21c38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/background/spider.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ const tcpServer = net.createServer();
tcpServer.listen(config.spiderPort);
tcpServer.on('connection', (socket) => {
socket = new JsonSocket(socket);
socket.on('error', (err) => {})
socket.on('message', (message) => {
if(message.type && messageHandlers[message.type])
{
Expand Down Expand Up @@ -1073,7 +1074,6 @@ const p2p = {
{
this.peers.push(address)
const socket = new JsonSocket(new net.Socket()); //Decorate a standard net.Socket with JsonSocket
socket.connect(address.port, address.address);
socket.on('connect', () => { //Don't send until we're connected
// add to peers
send('peer', this.peers.length)
Expand Down Expand Up @@ -1113,6 +1113,8 @@ const p2p = {
})

socket.on('error', (err) => {})

socket.connect(address.port, address.address);
},
emit(type, data, callback)
{
Expand Down

0 comments on commit 4b21c38

Please sign in to comment.