From 4f470e26499cb8f857855e3e8979f4b6685f5830 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 30 Sep 2016 03:11:24 -0400 Subject: [PATCH] no debug buf.toString() --- mux-ws.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mux-ws.js b/mux-ws.js index 43591d4..983665b 100644 --- a/mux-ws.js +++ b/mux-ws.js @@ -156,7 +156,7 @@ require('cluster-store').create().then(function (store) { remote.unpacker = packer.create(handlers); ws.on('message', function (chunk) { console.log('message from home cloud to tunneler to browser', chunk.byteLength); - console.log(chunk.toString()); + //console.log(chunk.toString()); remote.unpacker.fns.addChunk(chunk); }); ws.on('close', function () { @@ -247,6 +247,10 @@ require('cluster-store').create().then(function (store) { console.log('[' + Date.now() + '] socket data', chunk.byteLength); myDuplex.push(chunk); }); + socket.on('error', function (err) { + console.error('[error] connectHttps TODO close'); + console.error(err); + }); } function pipeWs(servername, service, browser, remote) { @@ -278,10 +282,12 @@ require('cluster-store').create().then(function (store) { bstream.wrapped.on('data', function (pchunk) { // var chunk = socket.read(); console.log('[bstream] data from browser to tunneler', pchunk.byteLength); - console.log(JSON.stringify(pchunk.toString())); + //console.log(JSON.stringify(pchunk.toString())); ws.send(pchunk, { binary: true }); }); - bstream.wrapped.on('error', function () { + bstream.wrapped.on('error', function (err) { + console.error('[error] bstream.wrapped.error'); + console.error(err); try { ws.send(packer.pack(baddress, null, 'error'), { binary: true }); } catch(e) { @@ -388,6 +394,10 @@ require('cluster-store').create().then(function (store) { })); browser.end(); }); + browser.on('error', function (err) { + console.error('[error] tcp socket raw TODO forward and close'); + console.error(err); + }); }); });