Skip to content

Commit

Permalink
Merge pull request #1681 from alttester/1680-intermittent-c-driver-co…
Browse files Browse the repository at this point in the history
…nnection-cant-be-terminated-from-desktop-when-error-occurs-during-connection

Added a try catch to fix issue with checkServerVersion
  • Loading branch information
andreion1ca authored Aug 14, 2024
2 parents 8f823f1 + 9e7adc6 commit 51582ce
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Assets/AltTester/Runtime/AltDriver/AltDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,20 @@ public AltDriver(string host = "127.0.0.1", int port = 13000, string appName = "
deviceInstanceId,
driverType
);
communicationHandler = new DriverCommunicationHandler(host, port, connectTimeout, appName, platform, platformVersion, deviceInstanceId, appId, driverType);
communicationHandler.Connect();

checkServerVersion();
while (true)
{
communicationHandler = new DriverCommunicationHandler(host, port, connectTimeout, appName, platform, platformVersion, deviceInstanceId, appId, driverType);
communicationHandler.Connect();
try
{
checkServerVersion();
break;
}
catch (NullReferenceException)//There is a strange situation when sometimes checkServerVersion throws that command params is null. I investigated but didn't find the cause.
{
communicationHandler.Close();
}
}
}
}

Expand Down

0 comments on commit 51582ce

Please sign in to comment.