-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Add basic classes to support the usage of tunnels. #66
Conversation
Add the basic classes that are needed to support the creation of tcp tunnels to the devices. A following commit will provide the required CLI option and integration to the runner to support this.
Please review in case something need to be changed in the API, once is approved and merged I'll add support for it, atm is not used. |
...Harness.iOS.Shared/TestImporter/Templates/Managed/Resources/src/common/ApplicationOptions.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments
{ | ||
var se = e as SocketException; | ||
if (se == null || se.SocketErrorCode != SocketError.Interrupted) | ||
Console.WriteLine("[{0}] : {1}", DateTime.Now, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console or Log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandel-macaque is this still open?
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/SimpleTcpListener.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TcpTunnel.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TunnelBore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TunnelBore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TunnelBore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TunnelBore.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.XHarness.iOS.Shared/Listeners/TunnelBore.cs
Outdated
Show resolved
Hide resolved
....Shared/TestImporter/Templates/Managed/Resources/src/common/TestRunner/Core/TcpTextWriter.cs
Show resolved
Hide resolved
…stener.cs As per review comments. Co-Authored-By: Přemek Vysoký <[email protected]>
… to clean resources better.
Failing tests are unrelated, but merging with master should fix them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
public TcpTunnelArgument(int port) | ||
{ | ||
if (port <= 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impossible for this to be null or > 65535?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int cannot be null, if is too large, the exception will be raised later
} | ||
catch (SocketException ex) | ||
{ | ||
if (timeout == 100 && watch.ElapsedMilliseconds > 20000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the kind of values that might be nice to be constants at the top of the file
namespace Microsoft.DotNet.XHarness.iOS.Shared.Listeners | ||
{ | ||
|
||
// interface to be implemented by those listener that can use a tcp tunnel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: listeners
public Task<bool> Started { get; } | ||
} | ||
|
||
// represents a tunnel created between a device and a host. This tunnel allows the communication between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: allows communication
new DeviceNameArgument (device), | ||
}; | ||
|
||
// use a cancelation token, later will be used to kill the tcp tunnel proces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: process
simpleListener.TunnelHoleThrough.TrySetResult(true); | ||
} | ||
}); | ||
// do not await since we are going to be running the process is parallel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: in parallel
Add the basic classes that are needed to support the creation of tcp
tunnels to the devices. A following commit will provide the required CLI
option and integration to the runner to support this.