public async Task <ActionResult <bool> > Reboot([FromBody] RebootRequest request) { if (request == null) { return(BadRequest()); } return(await Execute(request.SipAddress, async (codecApi, codecInformation) => await codecApi.RebootAsync(codecInformation.Ip))); }
public IObservable <Unit> Reboot() { return(Observable.Create <Unit>(observer => { var request = new RebootRequest(); var rebootResponse = _actionServiceClient.Reboot(request); var actionResult = rebootResponse.ActionResult; if (actionResult.Result == ActionResult.Types.Result.Success) { observer.OnCompleted(); } else { observer.OnError(new ActionException(actionResult.Result, actionResult.ResultStr)); } return Task.FromResult(Disposable.Empty); })); }
public void SendReboot() { while (RequestProccess.ThreadCount > 1) { Thread.Sleep(300); //wait... } ServerSocket.Close(); ServerSocket.Dispose(); ServerSocket = null; GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); ServerSocket.Bind(new IPEndPoint(IPAddress.Any, Port)); ServerSocket.Listen(0); ServerSocket.BeginAccept(AcceptCallback, null); RebootRequest?.Invoke(); }
public void Start(bool waitForUserTypeExit = true) { if (Started) { throw new Exception("Server already has been started."); } Stopwatch sw = new Stopwatch(); sw.Start(); Initialize(); ServerSocket.Bind(new IPEndPoint(IPAddress.Any, Port)); ServerSocket.Listen(0); ServerSocket.BeginAccept(AcceptCallback, null); Started = true; ServerStarted?.Invoke(); RunServerStartupTasks(); sw.Stop(); LogController.WriteLog(new ServerLog($"Server started in {sw.ElapsedMilliseconds}ms", "Server", "Start")); LogController.WriteLog(new ServerLog($"Running at port {Port}")); Console.WriteLine("Type 'exit' to stop; 'reboot' to send reboot request event..."); string line = ""; if (waitForUserTypeExit) { while (line != "exit") { line = Console.ReadLine(); if (line == "reboot") { RebootRequest?.Invoke(); } } } }
public async Task Rebout() { var reboutRequest = new RebootRequest(true); var result = await ExecuteTaskAsync <string>(reboutRequest).ConfigureAwait(false); }