Exemple #1
0
        // Release all Bridge resources.
        // If 'force' is true, it means the Bridge is shutting down
        // and even the firewall rules necessary to talk to the Bridge
        // will be removed.
        public static void ReleaseAllResources(bool force)
        {
            // Cleanly shutdown all AppDomains we own so they have
            // the chance to release resources they've acquired or installed
            AppDomainManager.ShutdownAllAppDomains();

            // Uninstall any certificates added or used by the Bridge itself
            CertificateManager.UninstallAllCertificates(force: true);

            // Force the removal of the SSL cert that may have been added
            // by another AppDomain or left from a prior run
            int httpsPort = ConfigController.BridgeConfiguration.BridgeHttpsPort;

            if (httpsPort != 0)
            {
                CertificateManager.UninstallSslPortCertificate(httpsPort);
            }

            // Finally remove all firewall rules we added for the ports
            PortManager.RemoveAllBridgeFirewallRules();

            // If the Bridge is not being shutdown, open a port in the firewall to
            // communicate with the Bridge itself.
            if (!force)
            {
                PortManager.OpenPortInFirewall(ConfigController.BridgeConfiguration.BridgePort);
            }
        }
Exemple #2
0
        static ConfigController()
        {
            BridgeLock = new object();

            // Register to manage AppDomains in response to changes to the resource folder
            ResourceFolderChanged += (object s, ChangedEventArgs <string> args) =>
            {
                CurrentAppDomainName = AppDomainManager.OnResourceFolderChanged(args.OldValue, args.NewValue);
            };
        }
        public static void ReleaseAllResources()
        {
            // Cleanly shutdown all AppDomains we own so they have
            // the chance to release resources they've acquired or installed
            AppDomainManager.ShutdownAllAppDomains();

            // Force the removal of the SSL cert that may have been added
            // by another AppDomain or left from a prior run
            int httpsPort = ConfigController.BridgeConfiguration.BridgeHttpsPort;

            if (httpsPort != 0)
            {
                CertificateManager.UninstallSslPortCertificate(httpsPort);
            }

            CertificateManager.UninstallAllCertificates();
            PortManager.RemoveAllBridgeFirewallRules();
        }