Skip to content
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

Merged
merged 10 commits into from
Apr 23, 2020

Conversation

mandel-macaque
Copy link
Member

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.

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.
@mandel-macaque
Copy link
Member Author

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.

Copy link
Member

@premun premun left a 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console or Log?

Copy link
Member

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?

@mandel-macaque
Copy link
Member Author

Failing tests are unrelated, but merging with master should fix them.

Copy link
Member

@MattGal MattGal left a 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)
Copy link
Member

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?

Copy link
Member Author

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)
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: in parallel

@mandel-macaque mandel-macaque merged commit a43bc34 into dotnet:master Apr 23, 2020
@mandel-macaque mandel-macaque deleted the tunnel-bore branch April 23, 2020 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants