Reset pollCount; debug log when expired generated by client

This commit is contained in:
Zach Fox 2017-03-30 17:02:15 -07:00
parent 05c34fb3ee
commit 4712ec7400

View file

@ -403,6 +403,7 @@ function startHandshake(fromKeyboard) {
animHandlerId = MyAvatar.addAnimationStateHandler(shakeHandsAnimation, []);
}
debug("starting handshake for", currentHand);
pollCount = 0;
state = STATES.waiting;
connectingId = undefined;
connectingHand = undefined;
@ -557,6 +558,7 @@ function handleConnectionResponseAndMaybeRepeat(error, response) {
if (response && (response.connection === 'pending')) {
debug(response, 'pollCount', pollCount);
if (pollCount++ >= POLL_LIMIT) { // server will expire, but let's not wait that long.
debug('POLL LIMIT REACHED; TIMEOUT: expired message generated by CLIENT');
result = {status: 'error', connection: 'expired'};
connectionRequestCompleted();
} else { // poll