public WorkerNetwork(WorkerNetworkSystem system, TcpClient client, GridWorker worker) { _networkSystem = system; _gridWorker = worker; _tcpClient = client; _netStream = client.GetStream(); _checkDisconnectTime = DateTime.Now.Ticks; _currentHandler = new WorkerNetworkHandler(this, system); }
public static void Main(string[] args) { var info = VersionUtils.GetAssemblyNameInfo(); _isRequestShutdown = false; Console.Title = "ZGrid Worker"; Logger.Info($"Starting ZGrid Worker {info.Version.Major}.{info.Version.Minor}.{info.Version.MinorRevision} ({info.ProcessorArchitecture}) ..."); _gridWorker = new GridWorker(); _mainThread = new Thread(ThreadMain) { IsBackground = true }; _netThread = new Thread(ThreadNetwork) { IsBackground = true }; if (!Directory.Exists("jobs_temp")) { Directory.CreateDirectory("jobs_temp"); } try { _gridWorker.Init(); Console.Title = $"ZGrid Worker: {_gridWorker.Settings.WorkerName}"; Logger.Info("Server is initialized"); } catch (Exception e) { Logger.Error("Unable to initialize ZGrid Worker", e); return; } _mainThread.Start(); _netThread.Start(); Logger.Info("Type 'exit' to exit from application"); string input; while ((input = Console.ReadLine()) != null) { if (string.IsNullOrEmpty(input)) { continue; } if (input.Equals("exit")) { Shutdown(); return; } } }
public WorkerNetworkSystem(GridWorker gridWorker) { _isInitialized = false; _gridWorker = gridWorker; _filesToDownload = new List <GridJobFile>(); }