public void Update() { if (targetServer != "" && (Time.frameCount % 10 == 0)) { if (thinClients.Count < thinClientNum.IntValue) { GameDebug.Log("Creating new thin client:" + thinClients.Count); var c = new ThinClient(); thinClients.Add(c); c.Connect(targetServer); } else if (thinClients.Count > thinClientNum.IntValue && thinClients.Count > 0) { GameDebug.Log("Removing thin client:" + thinClients.Count); var i = thinClients.Count - 1; thinClients[i].Disconnect(); thinClients.RemoveAt(i); } } for (int i = 0; i < thinClients.Count; ++i) { thinClients[i].Update(); } }
public ThinClient CreateThinClient(StrTable?stb) { AddressFamily listenFamily = AddressFamily.InterNetwork; IPAddress listenAddress = IPAddress.Loopback; if (this.SettingsFastSnapshot.Debug_GuacdMode_ProxyPortListenAllowAny) { listenAddress = IPAddress.Any; } if (this.SettingsFastSnapshot.IsConfigured() == false) { throw new CoresException(stb != null ? stb["THINWEB_NOT_CONFIGURED"] : "ThinWebClient.json is not configured."); } ThinClient tc = new ThinClient(new ThinClientOptions(new WideTunnelOptions("DESK", nameof(ThinWebClient), this.SettingsFastSnapshot.ThinControllerUrlList, this.Options.MasterCertificates, waterMark: this.Hook.GetProtocolWatermarkBinary(), controllerGateSecretKey: this.SettingsFastSnapshot.ControllerGateSecretKey), this.SessionManager, listenFamily, listenAddress)); return(tc); }
public void LargeMigrationSelf(int numberOfIterations, string requestedStorage) { var backupLocation = NewDataPath("Self-Backup", forceCreateDir: true); DataGenerator generator; using (var store = NewRemoteDocumentStore(runInMemory: false, requestedStorage: requestedStorage)) { using (var client = new ThinClient(store.Url, DatabaseName)) { generator = new DataGenerator(client, numberOfIterations); client.PutDatabase(DatabaseName); generator.Generate(); client.StartBackup(DatabaseName, backupLocation, waitForBackupToComplete: true); } } using (var store = NewRemoteDocumentStore(runInMemory: false)) { store.DefaultDatabase = "Northwind"; var operation = store .DatabaseCommands .GlobalAdmin .StartRestore(new DatabaseRestoreRequest { BackupLocation = backupLocation, DatabaseName = "Northwind" }); operation.WaitForCompletion(); ValidateBackup(store, generator); } }
public void LargeMigration(int numberOfIterations) { var exceptions = new List <Exception>(); foreach (var configuration in serversToTest) { foreach (var storageType in configuration.StorageTypes) { KillPreviousServers(); Console.WriteLine("|> Processing: {0}. Storage: {1}.", configuration.Name, storageType); var backupLocation = NewDataPath(configuration.Name + "-Backup", forceCreateDir: true); using (var client = new ThinClient(string.Format("http://localhost:{0}", Port), DatabaseName)) { var generator = new DataGenerator(client, numberOfIterations); using (var server = DeployServer(configuration.Name, storageType)) { File.AppendAllLines(ServersFileName, new[] { server.ProcessId.ToString(CultureInfo.InvariantCulture) }); client.PutDatabase(DatabaseName); generator.Generate(); if (configuration.WaitForIndexingBeforeBackup) { client.WaitForIndexing(); } client.StartBackup(DatabaseName, backupLocation, waitForBackupToComplete: true); } using (var store = NewRemoteDocumentStore(runInMemory: false)) { store.DefaultDatabase = "Northwind"; var operation = store .DatabaseCommands .GlobalAdmin .StartRestore(new DatabaseRestoreRequest { BackupLocation = backupLocation, DatabaseName = "Northwind" }); operation.WaitForCompletion(); try { ValidateBackup(store, generator); } catch (Exception e) { Console.WriteLine(e); exceptions.Add(new InvalidOperationException("Migration failed: " + configuration.Name + ". Storage: " + storageType + ". Message: " + e.Message, e)); } } } } } if (exceptions.Count > 0) { throw new AggregateException(exceptions); } }