public LockerDevice(LockerDevicesManager clientManager, Socket Socket)
     : base(Socket)
 {
     ClientManager              = clientManager;
     LastTimeReaden             = Time.GetTime();
     MessagesWaitingForResponse = new ConcurrentDictionary <long, TaskCompletionSource <object> >();
     LastPacketID = 0;
 }
 public override void Dispose()
 {
     base.Dispose();
     ClientManager = null;
     foreach (var keyvalue in MessagesWaitingForResponse)
     {
         MessagesWaitingForResponse.Remove(keyvalue.Key, out _);
         try
         {
             keyvalue.Value?.SetCanceled();
         }
         catch (Exception)
         {
         }
     }
 }