Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@ -45,11 +45,16 @@ namespace System.ServiceModel.PeerResolvers
public class CustomPeerResolverService : IPeerResolverContract
{
static ServiceHost localhost;
static int port;
static void SetupCustomPeerResolverServiceHost ()
{
string customPort = Environment.GetEnvironmentVariable ("MONO_CUSTOMPEERRESOLVERSERVICE_PORT");
if (customPort == null || !int.TryParse (customPort, out port))
port = 8931;
// launch peer resolver service locally only when it does not seem to be running ...
var t = new TcpListener (8931);
var t = new TcpListener (port);
try {
t.Start ();
t.Stop ();
@ -59,7 +64,7 @@ namespace System.ServiceModel.PeerResolvers
Console.WriteLine ("WARNING: it is running peer resolver service locally. This means, the node registration is valid only within this application domain...");
var host = new ServiceHost (new LocalPeerResolverService (TextWriter.Null));
host.Description.Behaviors.Find<ServiceBehaviorAttribute> ().InstanceContextMode = InstanceContextMode.Single;
host.AddServiceEndpoint (typeof (ICustomPeerResolverContract), new BasicHttpBinding (), "http://localhost:8931");
host.AddServiceEndpoint (typeof (ICustomPeerResolverContract), new BasicHttpBinding (), $"http://localhost:{port}");
localhost = host;
host.Open ();
}
@ -70,7 +75,7 @@ namespace System.ServiceModel.PeerResolvers
public CustomPeerResolverService ()
{
client = ChannelFactory<ICustomPeerResolverClient>.CreateChannel (new BasicHttpBinding (), new EndpointAddress ("http://localhost:8931"));
client = ChannelFactory<ICustomPeerResolverClient>.CreateChannel (new BasicHttpBinding (), new EndpointAddress ($"http://localhost:{port}"));
refresh_interval = new TimeSpan (0, 10, 0);
cleanup_interval = new TimeSpan (0, 1, 0);