From fb8aa998b30409781978e7b5e219fab1a3046aad Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 8 Aug 2018 03:14:40 -0600 Subject: [PATCH] don't expect data on 'connection' event --- lib/remote.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/remote.js b/lib/remote.js index fb31c27..7261d74 100644 --- a/lib/remote.js +++ b/lib/remote.js @@ -52,8 +52,12 @@ function _connect(state) { + "(" + clientHandlers.count() + " clients)"); conn.tunnelCid = cid; - conn.tunnelRead = tun.data.byteLength; - conn.tunnelWritten = 0; + if (tun.data) { + conn.tunnelRead = tun.data.byteLength; + } else { + conn.tunnelRead = 0; + } + conn.tunnelWritten = 0; conn.on('data', function onLocalData(chunk) { //var chunk = conn.read(); @@ -323,7 +327,6 @@ function _connect(state) { } , onconnection: function (tun) { - console.log("[debug] got connection event"); var cid = tun._id = Packer.addrToId(tun); // this data should have been gathered already as part of the proxy protocol @@ -353,7 +356,7 @@ function _connect(state) { handled = clientHandlers.write(cid, tun); // quasi backwards compat - if (!handled) { console.log("[debug] did not get connection event"); packerHandlers.onconnection(tun); } + if (!handled) { console.log("[debug] did not get 'connection' event"); packerHandlers.onconnection(tun); } } , onpause: function (opts) {