Test for blocked ports when adding a PC fails

This commit is contained in:
Cameron Gutman 2020-08-08 18:11:25 -07:00
parent ec17623400
commit ad08440023
3 changed files with 18 additions and 7 deletions

View file

@ -607,7 +607,7 @@ public:
}
signals:
void computerAddCompleted(QVariant success);
void computerAddCompleted(QVariant success, QVariant detectedPortBlocking);
void computerStateChanged(NvComputer* computer);
@ -637,7 +637,11 @@ private:
return serverInfo;
} catch (...) {
if (!m_Mdns) {
emit computerAddCompleted(false);
// We failed to connect to the specified PC. Let's test to make sure this network
// isn't blocking Moonlight, so we can tell the user about it.
int portTestResult = LiTestClientConnectivity("qt.conntest.moonlight-stream.org", 443,
ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989);
emit computerAddCompleted(false, portTestResult != 0 && portTestResult != ML_TEST_RESULT_INCONCLUSIVE);
}
return QString();
}
@ -729,7 +733,7 @@ private:
// For non-mDNS clients, let them know it succeeded
if (!m_Mdns) {
emit computerAddCompleted(true);
emit computerAddCompleted(true, false);
}
// Tell our client if something changed
@ -750,7 +754,7 @@ private:
// For non-mDNS clients, let them know it succeeded
if (!m_Mdns) {
emit computerAddCompleted(true);
emit computerAddCompleted(true, false);
}
// Tell our client about this new PC

View file

@ -188,7 +188,7 @@ signals:
void pairingCompleted(NvComputer* computer, QString error);
void computerAddCompleted(QVariant success);
void computerAddCompleted(QVariant success, QVariant detectedPortBlocking);
void quitAppCompleted(QVariant error);

View file

@ -58,11 +58,18 @@ CenteredGridView {
}
}
function addComplete(success)
function addComplete(success, detectedPortBlocking)
{
if (!success) {
errorDialog.text = "Unable to connect to the specified PC."
if (detectedPortBlocking) {
errorDialog.text += "\n\nThis PC's Internet connection is blocking Moonlight. Streaming over the Internet may not work while connected to this network."
}
else {
errorDialog.helpText = "Click the Help button for possible solutions."
}
errorDialog.open()
}
}