From 5b5695663707f63c0c15e503262d3a664b281b6f Mon Sep 17 00:00:00 2001 From: David Kelly Date: Thu, 4 May 2017 12:38:17 -0700 Subject: [PATCH] Some minor handshake improvements --- scripts/system/makeUserConnection.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/system/makeUserConnection.js b/scripts/system/makeUserConnection.js index 78be54f774..7509b246ea 100644 --- a/scripts/system/makeUserConnection.js +++ b/scripts/system/makeUserConnection.js @@ -122,7 +122,8 @@ function debug() { var stateString = "<" + STATE_STRINGS[state] + ">"; var connecting = "[" + connectingId + "/" + connectingHandJointIndex + "]"; - print.apply(null, [].concat.apply([LABEL, stateString, JSON.stringify(waitingList), connecting], + var current = "[" + currentHand + "/" + currentHandJointIndex + "]" + print.apply(null, [].concat.apply([LABEL, stateString, current, JSON.stringify(waitingList), connecting], [].map.call(arguments, JSON.stringify))); } @@ -768,11 +769,20 @@ // value for isKeyboard, as we should not change the animation // state anyways (if any) startHandshake(); + } else { + // they just created a connection request to us, and we are connecting to + // them, so lets just stop connecting and make connection.. + makeConnection(connectingId); + stopConnecting(); } } else { - // if waiting or inactive, lets clear the connecting id. If in makingConnection, - // do nothing - if (state !== STATES.MAKING_CONNECTION && connectingId === senderID) { + if (state == STATES.MAKING_CONNECTION && connectingId === senderID) { + // we are making connection, they just started, so lets reset the + // poll count just in case + pollCount = 0; + } else { + // if waiting or inactive, lets clear the connecting id. If in makingConnection, + // do nothing clearConnecting(); if (state !== STATES.INACTIVE) { startHandshake();