Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ataraxia-local

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ataraxia-local - npm Package Compare versions

Comparing version 0.3.0 to 0.3.2

43

index.js

@@ -22,16 +22,37 @@ 'use strict';

const id = path.join(os.tmpdir(), options.name + '');
this.leader = leader(id);
this.leader.on('leader', () => {
// Emit an event when this node becomes the leader
this.events.emit('leader');
});
const handlePeer = sock => {
const peer = new LocalPeer(this);
peer.setSocket(sock);
this.addPeer(peer);
const connect = () => {
this.leader = leader(id);
this.leader.on('leader', () => {
// Emit an event when this node becomes the leader
this.debug('This node is now the leader of the machine local network');
this.events.emit('leader');
});
const handlePeer = sock => {
const peer = new LocalPeer(this);
peer.setSocket(sock);
this.addPeer(peer);
};
this.leader.on('connection', handlePeer);
this.leader.on('client', handlePeer);
this.leader.on('error', err => {
this.debug('Trouble connecting to machine local network;', err);
try {
this.leader.close();
} catch(ex) {
// Do nothing
}
if(this.started) {
const delay = Math.floor(50 * Math.random() + 100);
this.debug('Retrying connection in ' + delay + 'ms');
setTimeout(connect, delay);
}
});
};
this.leader.on('connection', handlePeer);
this.leader.on('client', handlePeer);
connect();
}

@@ -38,0 +59,0 @@

{
"name": "ataraxia-local",
"version": "0.3.0",
"version": "0.3.2",
"description": "Machine-local transport for Ataraxia P2P messaging",

@@ -9,3 +9,3 @@ "main": "index.js",

"dependencies": {
"ataraxia": "^0.3.0",
"ataraxia": "^0.3.2",
"debug": "^3.1.0",

@@ -12,0 +12,0 @@ "unix-socket-leader": "^0.1.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc