public Server(DomainManager domains, ServerBase cloneBase) : base(domains, cloneBase) { if (cloneBase is Server) { Server clone = (Server)cloneBase; Cache = clone.Cache; DirectRemotes = clone.DirectRemotes; RemoteInfo = clone.RemoteInfo; Remotes = clone.Remotes; Lines = clone.Lines; NetworkEstablished = clone.NetworkEstablished; Listeners = clone.Listeners; if (clone.SaveTimer.Change(Timeout.Infinite, Timeout.Infinite)) { clone.SaveTimer.Dispose(); } } SaveTimer = new Timer(SaveProc); Initialize(); }
public Server(DomainManager domains) : base(domains, Environment.MachineName) { SaveTimer = new Timer(SaveProc); Lines = new LineSet(); DirectRemotes = new Dictionary<string, RemoteServer>(); Remotes = new Dictionary<string, RemoteServer>(); Settings = InitializeSettings(); LocalRehash(); Cache = Cache.Load(); if (Cache == null) { Cache = Cache.Create(); if (!Cache.Save()) { Console.WriteLine("Unable to save cache. Will not start until cache is writable for security."); Environment.Exit(1); return; } } Certificates = new CertificateManager(); string password = Settings.CertificatePassword; if (!Certificates.Load(Id, password) && !Certificates.Generate(Id, password)) { Console.WriteLine("Unable to generate certificate on non-Windows OS. There must be a single, valid X.509 certificate file named 'Certificate.{0}.*' in the current directory.", Id); Environment.Exit(1); return; } Initialize(); }