hypercore-protocol
Advanced tools
Comparing version 7.1.0 to 7.1.1
20
index.js
@@ -133,20 +133,22 @@ const SHP = require('simple-hypercore-protocol') | ||
onclose (channelId, message) { | ||
const ch = channelId < this.remote.length ? this.remote[channelId] : null | ||
let ch = channelId < this.remote.length ? this.remote[channelId] : null | ||
if (ch) { | ||
this.remote[channelId] = null | ||
if (ch.handlers && ch.handlers.onclose) ch.handlers.onclose() | ||
} else if (message.discoveryKey) { | ||
const local = this.getChannel(message.discoveryKey) | ||
if (local && local.handlers && local.handlers.onclose) local.handlers.onclose() | ||
ch = this.getChannel(message.discoveryKey) | ||
} | ||
if (ch && ch.localId > -1) { | ||
if (!ch) return | ||
if (ch.handlers && ch.handlers.onclose) { | ||
ch.handlers.onclose() | ||
} | ||
if (ch.localId > -1) { | ||
this.local[ch.localId] = null | ||
} | ||
if (ch) { | ||
this.created.delete(ch.discoveryKey.toString('hex')) | ||
this.stream._prefinalize() | ||
} | ||
this.created.delete(ch.discoveryKey.toString('hex')) | ||
this.stream._prefinalize() | ||
} | ||
@@ -153,0 +155,0 @@ |
{ | ||
"name": "hypercore-protocol", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"description": "Stream that implements the hypercore protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
32759