Commit 13e8008b authored by Paul Frazee's avatar Paul Frazee
Browse files

Fix occasional exception case

parent 771e89d2
......@@ -37,7 +37,7 @@ class DatEphemeralExtMsg extends EventEmitter {
if (watcher) {
var peer = watcher.getPeer(remoteId)
if (peer) {
return getPeerProtocolStream(peer).remoteSupports('ephemeral')
return remoteSupports(peer, 'ephemeral')
}
}
return false
......@@ -77,7 +77,7 @@ class DatWatcher {
send (remoteId, message = {}) {
// get peer and assure support exists
var peer = this.getPeer(remoteId)
if (!getPeerProtocolStream(peer).remoteSupports('ephemeral')) {
if (!remoteSupports(peer, 'ephemeral')) {
return
}
......@@ -176,6 +176,12 @@ function getPeerRemoteId (peer) {
return protocolStream.remoteId
}
function remoteSupports (peer, ext) {
var protocolStream = getPeerProtocolStream(peer)
if (!protocolStream) return false
return protocolStream.remoteSupports(ext)
}
function toRemoteId (peer) {
if (peer && typeof peer === 'object') {
return getPeerRemoteId(peer)
......
......@@ -570,7 +570,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/protocol-buffers-encodings/-/protocol-buffers-encodings-1.1.0.tgz",
"integrity": "sha512-SmjEuAf3hc3h3rWZ6V1YaaQw2MNJWK848gLJgzx/sefOJdNLujKinJVXIS0q2cBQpQn2Q32TinawZyDZPzm4kQ==",
"dev": true,
"requires": {
"signed-varint": "2.0.1",
"varint": "5.0.0"
......@@ -669,7 +668,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/signed-varint/-/signed-varint-2.0.1.tgz",
"integrity": "sha1-UKmYnafJjCxh2tEZvJdHDvhSgSk=",
"dev": true,
"requires": {
"varint": "5.0.0"
}
......@@ -857,8 +855,7 @@
"varint": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/varint/-/varint-5.0.0.tgz",
"integrity": "sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8=",
"dev": true
"integrity": "sha1-2Ca4n3SQcy+rwMDtaT7Uddyynr8="
},
"wrappy": {
"version": "1.0.2",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment