public void Stop()
        {
            if (!m_started)
            {
                return;
            }
            try
            {
                Log.WriteLine(LogLevel.Debug, "Stopping communication instance.");

                //  TODO notify the modules
                if (HasHttpEndpoints())
                {
                    StopHttpServer();
                }

                //  Unregister cloud storage
                memory_cloud = null;

                //  Shutdown message passing networking
                NativeNetwork.StopTrinityServer();

                //  Unregister communication instance
                Global.CommunicationInstance = null;
                var _config = TrinityConfig.CurrentClusterConfig;
                m_started = false;
                Log.WriteLine("{0} {1} is successfully stopped.", RunningMode, _config.MyInstanceId);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogLevel.Error, "CommunicationInstance: " + ex.ToString());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Stop listening for incoming connections.
        /// </summary>
        protected virtual void StopCommunicationListeners()
        {
            if (HasHttpEndpoints())
                StopHttpServer();

            //  Shutdown message passing networking
            NativeNetwork.StopTrinityServer();
        }