Display the failing ports when the connection fails

This commit is contained in:
Cameron Gutman 2020-12-23 13:56:15 -06:00
parent 22bebb6bbc
commit c414e1a168
4 changed files with 20 additions and 7 deletions

View file

@ -17,10 +17,14 @@ Item {
stageText = qsTr("Starting %1...").arg(stage)
}
function stageFailed(stage, errorCode)
function stageFailed(stage, errorCode, failingPorts)
{
// Display the error dialog after Session::exec() returns
streamSegueErrorDialog.text = qsTr("Starting %1 failed: Error %2").arg(stage).arg(errorCode)
if (failingPorts) {
streamSegueErrorDialog.text += "\n\n" + qsTr("Check your firewall and port forwarding rules for port(s): %1").arg(failingPorts)
}
}
function connectionStarted()

View file

@ -73,9 +73,12 @@ void Session::clStageStarting(int stage)
void Session::clStageFailed(int stage, int errorCode)
{
// Perform the port test now, while we're on the async connection thread and not blocking the UI.
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, LiGetPortFlagsFromStage(stage));
unsigned int portFlags = LiGetPortFlagsFromStage(stage);
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, portFlags);
emit s_ActiveSession->stageFailed(QString::fromLocal8Bit(LiGetStageName(stage)), errorCode);
char failingPorts[128];
LiStringifyPortFlags(portFlags, ", ", failingPorts, sizeof(failingPorts));
emit s_ActiveSession->stageFailed(QString::fromLocal8Bit(LiGetStageName(stage)), errorCode, QString(failingPorts));
#ifndef USE_ASYNC_CONNECT_THREAD
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
@ -85,7 +88,8 @@ void Session::clStageFailed(int stage, int errorCode)
void Session::clConnectionTerminated(int errorCode)
{
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, LiGetPortFlagsFromTerminationErrorCode(errorCode));
unsigned int portFlags = LiGetPortFlagsFromTerminationErrorCode(errorCode);
s_ActiveSession->m_PortTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, portFlags);
// Display the termination dialog if this was not intended
switch (errorCode) {
@ -94,7 +98,12 @@ void Session::clConnectionTerminated(int errorCode)
case ML_ERROR_NO_VIDEO_TRAFFIC:
s_ActiveSession->m_UnexpectedTermination = true;
emit s_ActiveSession->displayLaunchError(tr("No video received from host. Check the host PC's firewall and port forwarding rules."));
char ports[128];
SDL_assert(portFlags != 0);
LiStringifyPortFlags(portFlags, ", ", ports, sizeof(ports));
emit s_ActiveSession->displayLaunchError(tr("No video received from host.") + "\n\n"+
tr("Check your firewall and port forwarding rules for port(s): %1").arg(ports));
break;
case ML_ERROR_NO_VIDEO_FRAME:

View file

@ -42,7 +42,7 @@ public:
signals:
void stageStarting(QString stage);
void stageFailed(QString stage, int errorCode);
void stageFailed(QString stage, int errorCode, QString failingPorts);
void connectionStarted();

@ -1 +1 @@
Subproject commit ce546b12b0135c6267edff4a04f0d83925a8a25d
Subproject commit cca2ba9aabfc0e9ae18b980e7ecc08abb3888ec1