Beispiel #1
0
        public IActionResult HasConnection()
        {
            try
            {
                return(Json(sshConnection.HasConnection()));
            }
            catch (SshConnectionException)
            {
                return(Json(false));
            }
            catch (SshOperationTimeoutException)
            {
                return(Json(false));
            }
            catch (AggregateException ex)
            {
                foreach (Exception x in ex.InnerExceptions)
                {
                    if (x.GetType().GetTypeInfo().BaseType == typeof(SocketException))
                    {
                        return(Json(false));
                    }
                }

                throw ex;
            }
        }