Example #1
0
        private void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!this.m_bDisposed)
            {
                if (disposing)
                {
                    if (null != m_WlanApi)
                    {
                        m_WlanApi.Dispose();
                        m_WlanApi = null;
                    }
                    if (null != m_ApConfigClient)
                    {
                        //m_ApConfigClient.StopRadiusServer();
                        m_ApConfigClient.StopEchoServer(); // Service checks if echo server was running or not
                        m_ApConfigClient.Dispose();
                        m_ApConfigClient = null;
                    }
                    // TODO Dispose here
                }
            }

            m_bDisposed = true;
        }
        private void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!this.disposed)
            {
                if (disposing)
                {
                    Log("WhckRoaming : Cleaning up");
                    DeleteProfiles();

                    if (echoClient != null)
                    {
                        Log("WhckRoaming : Cleaning up Echo Client");
                        echoClient.Close();
                        echoClient = null;
                    }
                    if (null != Api)
                    {
                        Api.Dispose();
                        Api = null;
                    }
                    if (null != AC)
                    {
                        if (routers != null && routers.Count == 2)
                        {
                            Log("WhckRoaming: Cleaning up static route from AP server to router");
                            AC.ClearStaticRoute(routers[0]);
                        }

                        Log("WhckRoaming : Cleaning up stopping radius server");
                        AC.StopRadiusServer();
                        Log("WhckRoaming : Cleaning up stopping Echo server");
                        AC.StopEchoServer(); // Service checks if echo server was running or not
                        AC.Dispose();
                        AC = null;
                    }

                    // TODO Dispose here
                }
            }

            disposed = true;
        }
Example #3
0
        private bool RunIntegrityCheck()
        {
            testLogger.LogComment("Running integrity check");

            UInt16 port        = 7777;
            UInt16 streamBytes = Convert.ToUInt16(random.Next(10, 2000));

            nextIntegrityCheckTime = DateTime.Now.Add(integrityCheckInterval);
            using (ApConfigClient apConfigClient = new ApConfigClient(WlanStress.APServer))
            {
                testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "WlanStress.APServer: {0}", WlanStress.APServer));
                int  retries   = 3;
                bool connected = false;
                while (retries > 0)
                {
                    retries--;
                    testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Attempting to connect to AP machine.  Retries remaining: {0}", retries));
                    bool connect = apConfigClient.Connect();
                    if (connect)
                    {
                        testLogger.LogComment("Connection to AP Server Succeeded");
                        connected = true;
                        break;
                    }
                    else
                    {
                        testLogger.LogComment("Connection AP Server failed");
                        Wlan.Sleep(10000);
                    }
                }
                if (connected == false)
                {
                    testLogger.LogError("Giving up connecting to AP machine");
                    return(false);
                }

                apConfigClient.StartEchoServer(port, streamBytes, 1);

                ConnectForIntegrityCheck(apConfigClient, port, streamBytes);

                try
                {
                    using (Wlan wlanApi = new Wlan())
                    {
                        var wlanInterfaceList = wlanApi.EnumWlanInterfaces();
                        Verify.IsTrue(wlanInterfaceList.Count >= 1, string.Format(CultureInfo.InvariantCulture, "wlanInterfaceList.Count = {0}", wlanInterfaceList.Count));
                        var wlanInterface = wlanInterfaceList[0];

                        using (Win32Sockets win32Sockets = new Win32Sockets())
                        {
                            string localAddress = win32Sockets.FindIpAddress(wlanInterface.Id);
                            testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "IPAddress: {0}", localAddress));

                            using (TCPEchoClient echoClient = new TCPEchoClient(localAddress, ServiceAPChannelAddress, port, streamBytes))
                            {
                                echoClient.Connect();
                                echoClient.PerformEcho();
                                bool result = echoClient.IsResponseBufferValid();
                                testLogger.LogComment(string.Format(CultureInfo.InvariantCulture, "Echo Client Success: {0}", result));
                                return(result);
                            }
                        }
                    }
                }
                catch (Exception error)
                {
                    testLogger.LogComment("TlukeTest:  Exception hit");
                    testLogger.LogError(string.Format(CultureInfo.InvariantCulture, "Error While trying data path: {0}", error.ToString()));
                    return(false);
                }
                finally
                {
                    testLogger.LogComment("Cleaning Up Each Server");
                    apConfigClient.StopEchoServer();

                    using (Wlan wlanApi = new Wlan())
                    {
                        var wlanInterfaceList = wlanApi.EnumWlanInterfaces();
                        Verify.IsTrue(wlanInterfaceList.Count >= 1, string.Format(CultureInfo.InvariantCulture, "wlanInterfaceList.Count = {0}", wlanInterfaceList.Count));
                        var wlanInterface = wlanInterfaceList[0];

                        if (wlanInterface.State == WLAN_INTERFACE_STATE.wlan_interface_state_connected)
                        {
                            wlanApi.Disconnect(wlanInterface.Id, DisconnectWait);
                        }
                    }
                }
            }
        }