2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 11:32:59 +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] [Attribute]
public bool AutoReconnect { get; set; } = false; public bool AutoReconnect { get; set; } = false;
[Attribute]
public uint ReconnectInterval { get; set; } = 5;
[Attribute] [Attribute]
public string Username { get; set; } public string Username { get; set; }
@ -1317,7 +1320,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
if (AutoReconnect) if (AutoReconnect)
{ {
Console.Write("Reconnecting socket..."); Console.Write("Reconnecting socket...");
Task.Delay(5000).ContinueWith((x) => connectSocket(socket)); Task.Delay((int)ReconnectInterval).ContinueWith((x) => connectSocket(socket));
} }
else else
{ {
@ -1553,7 +1556,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
else if (AutoReconnect && !invalidCredentials) else if (AutoReconnect && !invalidCredentials)
{ {
// reconnect // reconnect
Task.Delay(5000).ContinueWith((x) => Reconnect()); Task.Delay((int)ReconnectInterval).ContinueWith((x) => Reconnect());
} }
else else
{ {

View File

@ -708,13 +708,11 @@ partial class DistributedConnection
{ {
if (res != null) 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); Unsubscribe(res);
// remove from cache
cache.Remove(res);
// remove from attached resources // remove from attached resources
//attachedResources.Remove(res); //attachedResources.Remove(res);

View File

@ -149,19 +149,16 @@ public class DistributedServer : NetworkServer<DistributedConnection>, IResource
// base.AddConnection(connection); // base.AddConnection(connection);
//} //}
bool one = false;
protected override void ClientConnected(DistributedConnection connection) protected override void ClientConnected(DistributedConnection connection)
{ {
// if (!one) //Task.Delay(10000).ContinueWith((x) =>
//connection.OnReady += ConnectionReadyEventReceiver; //{
Task.Delay(10000).ContinueWith((x) => // Console.WriteLine("By bye");
{ // // Remove me from here
Console.WriteLine("By bye"); // connection.Close();
// Remove me from here // one = true;
connection.Close(); //});
one = true;
});
} }

View File

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