no debug buf.toString()

This commit is contained in:
AJ ONeal 2016-09-30 03:11:24 -04:00
parent ab0731dd56
commit 4f470e2649
1 changed files with 13 additions and 3 deletions

View File

@ -156,7 +156,7 @@ require('cluster-store').create().then(function (store) {
remote.unpacker = packer.create(handlers); remote.unpacker = packer.create(handlers);
ws.on('message', function (chunk) { ws.on('message', function (chunk) {
console.log('message from home cloud to tunneler to browser', chunk.byteLength); 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); remote.unpacker.fns.addChunk(chunk);
}); });
ws.on('close', function () { ws.on('close', function () {
@ -247,6 +247,10 @@ require('cluster-store').create().then(function (store) {
console.log('[' + Date.now() + '] socket data', chunk.byteLength); console.log('[' + Date.now() + '] socket data', chunk.byteLength);
myDuplex.push(chunk); myDuplex.push(chunk);
}); });
socket.on('error', function (err) {
console.error('[error] connectHttps TODO close');
console.error(err);
});
} }
function pipeWs(servername, service, browser, remote) { function pipeWs(servername, service, browser, remote) {
@ -278,10 +282,12 @@ require('cluster-store').create().then(function (store) {
bstream.wrapped.on('data', function (pchunk) { bstream.wrapped.on('data', function (pchunk) {
// var chunk = socket.read(); // var chunk = socket.read();
console.log('[bstream] data from browser to tunneler', pchunk.byteLength); 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 }); 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 { try {
ws.send(packer.pack(baddress, null, 'error'), { binary: true }); ws.send(packer.pack(baddress, null, 'error'), { binary: true });
} catch(e) { } catch(e) {
@ -388,6 +394,10 @@ require('cluster-store').create().then(function (store) {
})); }));
browser.end(); browser.end();
}); });
browser.on('error', function (err) {
console.error('[error] tcp socket raw TODO forward and close');
console.error(err);
});
}); });
}); });