Socket
Socket
Sign inDemoInstall

ssb-conn

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ssb-conn - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

29

lib/conn-scheduler.js

@@ -10,4 +10,5 @@ "use strict";

exports.ConnScheduler = void 0;
const ziii_1 = require("ziii");
const secret_stack_decorators_1 = require("secret-stack-decorators");
const ConnQuery = require("ssb-conn-query");
const secret_stack_decorators_1 = require("secret-stack-decorators");
const pull = require('pull-stream');

@@ -21,3 +22,2 @@ const Pausable = require('pull-pause');

const debug = require('debug')('ssb:conn:scheduler');
require('zii');
let lastCheck = 0;

@@ -222,15 +222,13 @@ let lastValue = null;

const freeSlots = Math.max(quota - peersUp.length, 0);
peersUp
ziii_1.default(peersUp)
.z(sortByStateChange)
.z(take(excess))
.forEach(([addr]) => this.ssb.conn.disconnect(addr));
peersDown
.filter(p => !this.weBlockThem(p))
.filter(canBeConnected)
.filter(([, data]) => data.autoconnect !== false)
ziii_1.default(peersDown)
.z(peers => peers.filter(p => !this.weBlockThem(p)))
.z(peers => peers.filter(canBeConnected))
.z(peers => peers.filter(([, data]) => data.autoconnect !== false))
.z(passesGroupDebounce(groupMin))
.filter(passesExpBackoff(backoffStep, backoffMax))
.z(peers => Math.random() <= 0.3
? peers.z(shufflePeers)
: peers.z(sortByStateChange))
.z(peers => peers.filter(passesExpBackoff(backoffStep, backoffMax)))
.z(peers => Math.random() <= 0.3 ? shufflePeers(peers) : sortByStateChange(peers))
.z(take(freeSlots))

@@ -313,6 +311,3 @@ .forEach(([addr, data]) => this.ssb.conn.connect(addr, data));

});
conn
.query()
.peersConnectable('staging')
.filter(this.weFollowThem)
ziii_1.default(conn.query().peersConnectable('staging').filter(this.weFollowThem))
.z(take(3 - conn.query().peersInConnection().filter(this.weFollowThem).length))

@@ -388,5 +383,5 @@ .forEach(([addr, data]) => conn.connect(addr, data));

this.pubDiscoveryPausable = (_a = this.pubDiscoveryPausable) !== null && _a !== void 0 ? _a : Pausable();
pull(this.ssb.db.query(and(type('pub')), live({ old: true }), toPullStream()), pull.asyncMap((x, cb) => setTimeout(() => cb(null, x), 250)), pull.filter((msg) => { var _a; return ((_a = msg.content) === null || _a === void 0 ? void 0 : _a.address) && Ref.isAddress(msg.content.address); }), this.pubDiscoveryPausable, pull.drain((msg) => {
pull(this.ssb.db.query(and(type('pub')), live({ old: true }), toPullStream()), pull.asyncMap((x, cb) => setTimeout(() => cb(null, x), 250)), pull.filter((msg) => { var _a; return Ref.isAddress((_a = msg.value.content) === null || _a === void 0 ? void 0 : _a.address); }), this.pubDiscoveryPausable, pull.drain((msg) => {
try {
const address = Ref.toMultiServerAddress(msg.content.address);
const address = Ref.toMultiServerAddress(msg.value.content.address);
const key = Ref.getKeyFromAddress(address);

@@ -393,0 +388,0 @@ if (this.weBlockThem([address, { key }])) {

{
"name": "ssb-conn",
"description": "SSB plugin for establishing and managing peer connections",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "https://github.com/staltz/ssb-conn",

@@ -30,3 +30,3 @@ "main": "lib/index.js",

"statistics": "^3.3.0",
"zii": "~1.1.1"
"ziii": "~1.0.1"
},

@@ -33,0 +33,0 @@ "peerDependencies": {

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