close on error

This commit is contained in:
AJ ONeal 2016-10-12 19:11:11 -04:00
parent 6185b79263
commit 09a98f6b3a
1 changed files with 9 additions and 1 deletions

View File

@ -189,7 +189,15 @@ module.exports.create = function (opts) {
// 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()));
try {
ws.send(pchunk, { binary: true }); ws.send(pchunk, { binary: true });
} catch(e) {
try {
bstream.browser.end();
} catch(e) {
// ignore
}
}
}); });
bstream.wrapped.on('error', function (err) { bstream.wrapped.on('error', function (err) {
console.error('[error] bstream.wrapped.error'); console.error('[error] bstream.wrapped.error');