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.2 to 0.4.0

30

index.js

@@ -9,2 +9,4 @@ 'use strict';

const eos = require('end-of-stream');
/**

@@ -25,6 +27,9 @@ * Machine local transport. Uses Unix sockets to connect to peers on the

const connect = () => {
this.leader = leader(id);
this.leader.on('leader', () => {
this.leader = false;
this.net = leader(id);
this.net.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.leader = true;
this.events.emit('leader');

@@ -39,9 +44,19 @@ });

this.leader.on('connection', handlePeer);
this.leader.on('client', handlePeer);
this.leader.on('error', err => {
this.net.on('connection', handlePeer);
this.net.on('client', sock => {
if(this.leader) {
eos(sock, err => {
if(err) {
this.debug('Closed with error;', err);
}
});
} else {
handlePeer(sock);
}
});
this.net.on('error', err => {
this.debug('Trouble connecting to machine local network;', err);
try {
this.leader.close();
this.net.close();
} catch(ex) {

@@ -63,3 +78,3 @@ // Do nothing

stop() {
this.leader.close();
this.net.close();

@@ -74,3 +89,4 @@ super.stop();

// Disconnect does nothing for local transport
this.handleDisconnect();
}
}
{
"name": "ataraxia-local",
"version": "0.3.2",
"version": "0.4.0",
"description": "Machine-local transport for Ataraxia P2P messaging",

@@ -9,6 +9,10 @@ "main": "index.js",

"dependencies": {
"ataraxia": "^0.3.2",
"ataraxia": "^0.4.0",
"debug": "^3.1.0",
"end-of-stream": "^1.4.0",
"unix-socket-leader": "^0.1.2"
},
"devDependencies": {
"trace": "^3.0.0"
}
}
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