You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -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);
|
||||
|
@@ -95,7 +95,7 @@ namespace System.ServiceModel.PeerResolvers
|
||||
if (node == null)
|
||||
return new RefreshResponseInfo () { Result = RefreshResult.RegistrationNotFound };
|
||||
node.Refresh ();
|
||||
return new RefreshResponseInfo () { Result = RefreshResult.Success, RegistrationLifetime = RefreshInterval - (DateTime.Now - node.LastRefreshTime) };
|
||||
return new RefreshResponseInfo () { Result = RefreshResult.Success, RegistrationLifetime = RefreshInterval - (DateTime.UtcNow - node.LastRefreshTime) };
|
||||
}
|
||||
|
||||
public RegisterResponseInfo Register (RegisterInfo registerInfo)
|
||||
@@ -163,7 +163,7 @@ namespace System.ServiceModel.PeerResolvers
|
||||
lock (mesh) {
|
||||
var node = new Node () { ClientId = clientId, Address = addr };
|
||||
mesh.Add (node);
|
||||
node.LastRefreshTime = DateTime.Now;
|
||||
node.LastRefreshTime = DateTime.UtcNow;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
@@ -201,13 +201,13 @@ namespace System.ServiceModel.PeerResolvers
|
||||
|
||||
public void Refresh ()
|
||||
{
|
||||
LastRefreshTime = DateTime.Now;
|
||||
LastRefreshTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public void Update (PeerNodeAddress addr)
|
||||
{
|
||||
Address = addr;
|
||||
LastRefreshTime = DateTime.Now;
|
||||
LastRefreshTime = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user