/// <summary>
        /// Benchmark for client.
        /// </summary>
        /// <param name="state">The command [On|Off|Reset]</param>
        private static void MonitoringControl(MonitorState state)
        {
            switch (state)
            {
                case MonitorState.MonitorOn:
                    if (session != null && session.State == ProtocolSessionState.Opened)
                    {
                        if (protocolMonitor != null)
                        {
                            protocolMonitor.Dispose();
                        }

                        protocolMonitor = new ProtocolMonitor();
                        protocolMonitor.Attach(session);
                    }
                    else
                    {
                        protocolMonitor = new ProtocolMonitor();
                    }

                    break;

                case MonitorState.MonitorOff:
                    if (protocolMonitor != null)
                    {
                        protocolMonitor.Dispose();
                        protocolMonitor = null;
                    }

                    break;

                case MonitorState.MonitorReset:
                    if (protocolMonitor != null)
                    {
                        protocolMonitor.Reset();
                    }

                    break;

                default:
                    Http2Logger.LogError("CAPTURE-STATS needs [On|Off|Reset].");
                    break;
            }
        }
示例#2
0
        /// <summary>
        /// Benchmark for client.
        /// </summary>
        /// <param name="state">The command [On|Off|Reset]</param>
        private static void MonitoringControl(MonitorState state)
        {
            switch (state)
            {
                case MonitorState.MonitorOn:
                    if (session != null && session.State == SMSessionState.Opened)
                    {
                        if (protocolMonitor != null)
                        {
                            protocolMonitor.Dispose();
                        }

                        protocolMonitor = new ProtocolMonitor(session);
                        protocolMonitor.Attach();
                    }
                    else
                    {
                        SMLogger.LogError("Session was closed due to error or not opened. Use CONNECT <Uri> to open a new session.");
                    }

                    break;

                case MonitorState.MonitorOff:
                    if (protocolMonitor != null)
                    {
                        protocolMonitor.Dispose();
                        protocolMonitor = null;
                    }

                    break;

                case MonitorState.MonitorReset:
                    if (protocolMonitor != null)
                    {
                        protocolMonitor.Reset();
                    }

                    break;

                default:
                    SMLogger.LogError("CAPTURE-STATS needs [On|Off|Reset].");
                    break;
            }
        }