2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 03:32:57 +00:00
This commit is contained in:
Esiur Project 2022-08-13 04:02:21 +03:00
parent 21a2061fc4
commit f4d5eb0fdd
4 changed files with 18 additions and 22 deletions

View File

@ -1213,6 +1213,9 @@ public partial class DistributedConnection : NetworkConnection, IStore
[Attribute]
public bool AutoReconnect { get; set; } = false;
[Attribute]
public uint ReconnectInterval { get; set; } = 5;
[Attribute]
public string Username { get; set; }
@ -1317,7 +1320,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
if (AutoReconnect)
{
Console.Write("Reconnecting socket...");
Task.Delay(5000).ContinueWith((x) => connectSocket(socket));
Task.Delay((int)ReconnectInterval).ContinueWith((x) => connectSocket(socket));
}
else
{
@ -1553,7 +1556,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
else if (AutoReconnect && !invalidCredentials)
{
// reconnect
Task.Delay(5000).ContinueWith((x) => Reconnect());
Task.Delay((int)ReconnectInterval).ContinueWith((x) => Reconnect());
}
else
{

View File

@ -708,13 +708,11 @@ partial class DistributedConnection
{
if (res != null)
{
//var r = res as IResource;
//r.Instance.ResourceEventOccurred -= Instance_EventOccurred;
//r.Instance.CustomResourceEventOccurred -= Instance_CustomEventOccurred;
//r.Instance.ResourceModified -= Instance_PropertyModified;
//r.Instance.ResourceDestroyed -= Instance_ResourceDestroyed;
// unsubscribe
Unsubscribe(res);
// remove from cache
cache.Remove(res);
// remove from attached resources
//attachedResources.Remove(res);

View File

@ -149,19 +149,16 @@ 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;
});
//Task.Delay(10000).ContinueWith((x) =>
//{
// Console.WriteLine("By bye");
// // Remove me from here
// connection.Close();
// one = true;
//});
}

View File

@ -1,4 +1,2 @@
1- Change branch to main
2- Generic Records/Resources
3- Static functions calls
4- Scan assembly for child classes
1- Scan assembly for child classes
2- Auto reconnect id