You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

hyperdht

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperdht - npm Package Compare versions

Comparing version
6.20.1
to
6.20.2
+15
-4
index.js

@@ -45,2 +45,3 @@ const DHT = require('dht-rpc')

this._lastRandomPunch = 0
this._connectable = true
this._randomPunchInterval = opts.randomPunchInterval || 20000 // min 20s between random punches...

@@ -80,15 +81,25 @@ this._randomPunches = 0

async resume () {
await super.resume()
async resume ({ log = noop } = {}) {
await super.resume({ log })
const resuming = []
for (const server of this.listening) resuming.push(server.resume())
log('Resuming hyperdht servers')
await Promise.allSettled(resuming)
log('Done, hyperdht fully resumed')
}
async suspend () {
async suspend ({ log = noop } = {}) {
this._connectable = false // just so nothing gets connected during suspension
const suspending = []
for (const server of this.listening) suspending.push(server.suspend())
log('Suspending all hyperdht servers')
await Promise.allSettled(suspending)
await super.suspend()
log('Done, clearing all raw streams')
await this._rawStreams.clear()
log('Done, suspending dht-rpc')
await super.suspend({ log })
log('Done, clearing raw streams again')
await this._rawStreams.clear()
log('Done, hyperdht fully suspended')
this._connectable = true
}

@@ -95,0 +106,0 @@

@@ -49,3 +49,3 @@ const NoiseSecretStream = require('@hyperswarm/secret-stream')

// in case a socket is made during suspended state, destroy it immediately
if (dht.suspended) {
if (dht.suspended || !dht._connectable) {
encryptedSocket.destroy(SUSPENDED())

@@ -52,0 +52,0 @@ return encryptedSocket

{
"name": "hyperdht",
"version": "6.20.1",
"version": "6.20.2",
"description": "The DHT powering Hyperswarm",

@@ -21,2 +21,6 @@ "main": "index.js",

"default": "events"
},
"child_process": {
"bare": "bare-node-child-process",
"default": "child_process"
}

@@ -46,2 +50,3 @@ },

"devDependencies": {
"bare-node-child-process": "^1.0.1",
"brittle": "^3.0.0",

@@ -54,2 +59,3 @@ "graceful-goodbye": "^1.3.0",

"test": "standard && node test/all.js",
"test:bare": "bare test/all.js",
"test:generate": "brittle -r test/all.js test/*.js",

@@ -56,0 +62,0 @@ "lint": "standard",