/// <summary> /// Restarts the remote process if it crashes /// </summary> /// <returns>An awaitable task</returns> private async Task MonitorForRestartAsync() { while (!m_token.IsCancellationRequested) { Instance = new SpawnRemoteInstance(m_path, m_useSSL, m_storage, m_token); try { await Instance.Stopped; } catch { } } }
/// <summary> /// Creates a new indirect runner /// </summary> /// <param name="path">The path to the config file.</param> /// <param name="useSSL">If set to <c>true</c> use ssl.</param> /// <param name="storage">The storage interface to use.</param> /// <param name="token">A cancellation token to use.</param> public IndirectRunner(string path, bool useSSL, IStorageCreator storage, CancellationToken token) { m_path = path; m_useSSL = useSSL; m_storage = storage; m_token = token; // Make sure we have an instance before continuing Instance = new SpawnRemoteInstance(m_path, m_useSSL, m_storage, m_token); m_task = MonitorForRestartAsync(); }