2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 20:43:19 +00:00

AutoReconnect

This commit is contained in:
2022-08-11 21:28:16 +03:00
parent af94ce318a
commit 21a2061fc4
12 changed files with 355 additions and 154 deletions

View File

@@ -34,6 +34,7 @@ using Esiur.Core;
using System.Net;
using Esiur.Resource;
using Esiur.Security.Membership;
using System.Threading.Tasks;
namespace Esiur.Net.IIP;
public class DistributedServer : NetworkServer<DistributedConnection>, IResource
@@ -148,11 +149,20 @@ public class DistributedServer : NetworkServer<DistributedConnection>, IResource
// base.AddConnection(connection);
//}
bool one = false;
protected override void ClientConnected(DistributedConnection connection)
{
// if (!one)
//connection.OnReady += ConnectionReadyEventReceiver;
Task.Delay(10000).ContinueWith((x) =>
{
Console.WriteLine("By bye");
// Remove me from here
connection.Close();
one = true;
});
}
public override void Add(DistributedConnection connection)
@@ -178,9 +188,10 @@ public class DistributedServer : NetworkServer<DistributedConnection>, IResource
public KeyList<string, Delegate> Calls { get; } = new KeyList<string, Delegate>();
public void MapCall(string call, Delegate handler)
public DistributedServer MapCall(string call, Delegate handler)
{
Calls.Add(call, handler);
return this;
}
}