check your own location data on failure, and notify if it is wrong

This commit is contained in:
Howard Stearns 2017-04-30 09:44:34 -07:00
parent 92481bf475
commit eca7292651

View file

@ -600,6 +600,22 @@
debug("failing with result data", result);
// IWBNI we also did some fail sound/visual effect.
Window.makeConnection(false, result.connection);
if (Account.isLoggedIn()) { // Give extra failure info
request(location.metaverseServerUrl + '/api/v1/users/' + Account.username + '/location', function (error, response) {
var message = '';
if (error || response.status !== 'success') {
message = 'Unable to get location.';
} else if (!response.data || !response.data.location) {
message = "Unexpected location value: " + JSON.stringify(response);
} else if (response.data.location.node_id !== cleanId(MyAvatar.sessionUUID)) {
message = 'Session identification does not match database. Maybe you are logged in on another machine? That would prevent handshakes.' + JSON.stringify(response) + MyAvatar.sessionUUID;
}
if (message) {
Window.makeConnection(false, message);
}
debug("account location:", message || 'ok');
});
}
UserActivityLogger.makeUserConnection(connectingId, false, result.connection);
}
var POLL_INTERVAL_MS = 200, POLL_LIMIT = 5;
@ -612,7 +628,7 @@
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: 'no-partner-found'};
result = {status: 'error', connection: 'No logged-in partner found.'};
connectionRequestCompleted();
} else { // poll
Script.setTimeout(function () {