mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-18 00:56:38 +00:00
Avoid calling refreshServerInfo() before selecting an address
This commit is contained in:
parent
029f92f821
commit
344dcc0bc3
@ -170,7 +170,14 @@ function pairTo(nvhttpHost, onSuccess, onFailure) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _api = nvhttpHost;
|
var _api = nvhttpHost;
|
||||||
_api.refreshServerInfo().then(function (ret) {
|
_api.pollServer(function (ret) {
|
||||||
|
if (!_api.online) {
|
||||||
|
snackbarLog('Failed to connect to ' + _api.address + '! Are you sure the host is on?');
|
||||||
|
console.log(_api.toString());
|
||||||
|
onFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_api.paired) {
|
if (_api.paired) {
|
||||||
onSuccess();
|
onSuccess();
|
||||||
return;
|
return;
|
||||||
@ -205,12 +212,6 @@ function pairTo(nvhttpHost, onSuccess, onFailure) {
|
|||||||
console.log(_api.toString());
|
console.log(_api.toString());
|
||||||
onFailure();
|
onFailure();
|
||||||
});
|
});
|
||||||
}, function (failedRefreshInfo) {
|
|
||||||
snackbarLog('Failed to connect to ' + _api.address + '! Are you sure the host is on?');
|
|
||||||
console.log('Returned error was: ' + failedRefreshInfo);
|
|
||||||
console.log('failed API object: ');
|
|
||||||
console.log(_api.toString());
|
|
||||||
onFailure();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,15 +280,13 @@ function addHostToGrid(host) {
|
|||||||
function continueAddHost() {
|
function continueAddHost() {
|
||||||
var inputHost = $('#dialogInputHost').val();
|
var inputHost = $('#dialogInputHost').val();
|
||||||
var _nvhttpHost = new NvHTTP(inputHost, myUniqueid, inputHost);
|
var _nvhttpHost = new NvHTTP(inputHost, myUniqueid, inputHost);
|
||||||
|
|
||||||
pairTo(_nvhttpHost,
|
pairTo(_nvhttpHost,
|
||||||
function() {
|
function() {
|
||||||
_nvhttpHost.refreshServerInfo().then(function (onSuccess) {
|
beginBackgroundPollingOfHost(_nvhttpHost);
|
||||||
addHostToGrid(_nvhttpHost);
|
addHostToGrid(_nvhttpHost);
|
||||||
saveHosts();
|
saveHosts();
|
||||||
document.querySelector('#addHostDialog').close();
|
document.querySelector('#addHostDialog').close();
|
||||||
}, function (onFailure) {
|
|
||||||
console.log('FAILURE!');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
snackbarLog('pairing to ' + inputHost + ' failed!');
|
snackbarLog('pairing to ' + inputHost + ' failed!');
|
||||||
@ -584,6 +583,10 @@ function stopGameWithConfirmation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stopGame(callbackFunction) {
|
function stopGame(callbackFunction) {
|
||||||
|
if (!api.paired) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
api.refreshServerInfo().then(function (ret) {
|
api.refreshServerInfo().then(function (ret) {
|
||||||
api.getAppById(api.currentGame).then(function (runningApp) {
|
api.getAppById(api.currentGame).then(function (runningApp) {
|
||||||
if (!runningApp) {
|
if (!runningApp) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user