aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-01-28 04:17:42 +0800
committerGitHub <noreply@github.com>2017-01-28 04:17:42 +0800
commit61528bdf088e304150698d95218806d7b4faa56e (patch)
treefa330206277463e02dad2be9ee5d52bed794d7dc /app/scripts/lib
parent41bc9c221eb888ba1afe93b511698c21b0c8cf01 (diff)
parentefcd22905a585d8c2ae55ec4e8bd6d9b027b740d (diff)
downloadtangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar.gz
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar.bz2
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar.lz
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar.xz
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.tar.zst
tangerine-wallet-browser-61528bdf088e304150698d95218806d7b4faa56e.zip
Merge pull request #1058 from MetaMask/kumavis-refactor2
Ongoing refactor and cleanup
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/stream-utils.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/scripts/lib/stream-utils.js b/app/scripts/lib/stream-utils.js
index 1b7b89d14..ba79990cc 100644
--- a/app/scripts/lib/stream-utils.js
+++ b/app/scripts/lib/stream-utils.js
@@ -1,4 +1,5 @@
const Through = require('through2')
+const endOfStream = require('end-of-stream')
const ObjectMultiplex = require('./obj-multiplex')
module.exports = {
@@ -24,11 +25,11 @@ function jsonStringifyStream () {
function setupMultiplex (connectionStream) {
var mx = ObjectMultiplex()
connectionStream.pipe(mx).pipe(connectionStream)
- mx.on('error', function (err) {
- console.error(err)
+ endOfStream(mx, function (err) {
+ if (err) console.error(err)
})
- connectionStream.on('error', function (err) {
- console.error(err)
+ endOfStream(connectionStream, function (err) {
+ if (err) console.error(err)
mx.destroy()
})
return mx