p
This commit is contained in:
Malloc of Kuzkycyziklistan 2017-09-06 23:26:58 -05:00
parent 2937d799ae
commit ccc7ea5b25
2 changed files with 9 additions and 6 deletions

View file

@ -79,11 +79,12 @@ namespace SockScape {
} }
} }
if(LastMessageIn.Ticks == 0 && DeltaLastOut.TotalSeconds > 10) if (LastMessageIn.Ticks != 0) {
Send(new Packet(kIntraSlaveId.InitiationAttempt, Configuration.General["Master Secret"])); if(DeltaLastOut.TotalSeconds > 2)
else { Send(new Packet());
} else
} if(DeltaLastOut.TotalSeconds > 10)
Send(new Packet(kIntraSlaveId.InitiationAttempt, Configuration.General["Master Secret"]));
Thread.Sleep(1); Thread.Sleep(1);
} }

View file

@ -51,7 +51,8 @@ namespace SockScape {
if(packet == null) if(packet == null)
continue; continue;
Clients[client].LastReceive = DateTime.Now;
switch((kIntraSlaveId)packet.Id) { switch((kIntraSlaveId)packet.Id) {
case kIntraSlaveId.InitiationAttempt: case kIntraSlaveId.InitiationAttempt:
if(packet.RegionCount != 1 || IsProspectConnected(client)) if(packet.RegionCount != 1 || IsProspectConnected(client))
@ -155,6 +156,7 @@ namespace SockScape {
class Client { class Client {
public IPEndPoint Address { get; set; } public IPEndPoint Address { get; set; }
public DateTime LastReceive { get; set; } public DateTime LastReceive { get; set; }
public TimeSpan ReceiveDelta => DateTime.Now - LastReceive;
public Cipher Encryptor { get; set; } public Cipher Encryptor { get; set; }
public Key Key { get; set; } public Key Key { get; set; }
} }