don't expect data on 'connection' event

This commit is contained in:
AJ ONeal 2018-08-08 03:14:40 -06:00
parent 4a1f020100
commit fb8aa998b3
1 changed files with 7 additions and 4 deletions

View File

@ -52,8 +52,12 @@ function _connect(state) {
+ "(" + clientHandlers.count() + " clients)"); + "(" + clientHandlers.count() + " clients)");
conn.tunnelCid = cid; conn.tunnelCid = cid;
conn.tunnelRead = tun.data.byteLength; if (tun.data) {
conn.tunnelWritten = 0; conn.tunnelRead = tun.data.byteLength;
} else {
conn.tunnelRead = 0;
}
conn.tunnelWritten = 0;
conn.on('data', function onLocalData(chunk) { conn.on('data', function onLocalData(chunk) {
//var chunk = conn.read(); //var chunk = conn.read();
@ -323,7 +327,6 @@ function _connect(state) {
} }
, onconnection: function (tun) { , onconnection: function (tun) {
console.log("[debug] got connection event");
var cid = tun._id = Packer.addrToId(tun); var cid = tun._id = Packer.addrToId(tun);
// this data should have been gathered already as part of the proxy protocol // 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); handled = clientHandlers.write(cid, tun);
// quasi backwards compat // 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) { , onpause: function (opts) {