2
0
mirror of https://git.coolaj86.com/coolaj86/telebit-relay.js.git synced 2025-02-24 09:58:04 +00:00

close on error

This commit is contained in:
AJ ONeal 2016-10-12 19:11:11 -04:00
parent 6185b79263
commit 09a98f6b3a

View File

@ -189,7 +189,15 @@ module.exports.create = function (opts) {
// var chunk = socket.read();
console.log('[bstream] data from browser to tunneler', pchunk.byteLength);
//console.log(JSON.stringify(pchunk.toString()));
ws.send(pchunk, { binary: true });
try {
ws.send(pchunk, { binary: true });
} catch(e) {
try {
bstream.browser.end();
} catch(e) {
// ignore
}
}
});
bstream.wrapped.on('error', function (err) {
console.error('[error] bstream.wrapped.error');