Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="configServer"></param>
        internal static void ConfigServer( ref ConfigServer configServer )
        {
            //////////////////////////////////////////////////////////////////////////
            // 获取配置的信息

            LoadServerConfig();

            //////////////////////////////////////////////////////////////////////////
            // 设置配置的信息

            configServer.Service = ProcessServer.ConfigInfo.ServerConfig.Service;
            configServer.LogFile = ProcessServer.ConfigInfo.ServerConfig.LogFile;
            configServer.Cache = ProcessServer.ConfigInfo.ServerConfig.Cache;
            configServer.Debug = ProcessServer.ConfigInfo.ServerConfig.Debug;
            configServer.HaltOnWarning = ProcessServer.ConfigInfo.ServerConfig.HaltOnWarning;
            configServer.Profiling = ProcessServer.ConfigInfo.ServerConfig.Profiling;
            configServer.WorldThreadCount = ProcessServer.ConfigInfo.ServerConfig.WorldThreadCount;

            if ( ProcessServer.ConfigInfo.ServerConfig.ServerCachedSize > 0
                 && ProcessServer.ConfigInfo.ServerConfig.ServerBufferSize > 0
                 && ProcessServer.ConfigInfo.ServerConfig.ServerManageThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ServerSendThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ServerReceiveThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ServerProcessThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ServerMaxClients > 0
                && ProcessServer.ConfigInfo.ServerConfig.ServerOutTimeInterval >= 0 )
            {
                configServer.SetServerNetConfig( (int)ProcessServer.ConfigInfo.ServerConfig.ServerCachedSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerBufferSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerManageThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerSendThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerReceiveThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerProcessThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerMaxClients
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ServerOutTimeInterval );
            }


            if ( ProcessServer.ConfigInfo.ServerConfig.ClientCachedSize > 0
                 && ProcessServer.ConfigInfo.ServerConfig.ClientBufferSize > 0
                 && ProcessServer.ConfigInfo.ServerConfig.ClientManageThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ClientSendThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ClientReceiveThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ClientProcessThreadPoolSize > 0
                && ProcessServer.ConfigInfo.ServerConfig.ClientOutTimeInterval >= 0 )
            {
                configServer.SetClientNetConfig( (int)ProcessServer.ConfigInfo.ServerConfig.ClientCachedSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientBufferSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientManageThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientSendThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientReceiveThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientProcessThreadPoolSize
                    , (int)ProcessServer.ConfigInfo.ServerConfig.ClientOutTimeInterval );
            }
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="configServer"></param>
        private static void BaseServer_ConfigServer( ref ConfigServer configServer )
        {
            //////////////////////////////////////////////////////////////////////////
            // 获取配置的信息

            LoadVariables();

            configServer.Service = s_ConfigInfo.Service;
            configServer.LogFile = s_ConfigInfo.LogFile;
            configServer.Cache = s_ConfigInfo.Cache;
            configServer.Debug = s_ConfigInfo.Debug;
            configServer.HaltOnWarning = s_ConfigInfo.HaltOnWarning;
            configServer.Profiling = s_ConfigInfo.Profiling;
            configServer.WorldThreadCount = (byte)s_ConfigInfo.WorldThreadCount;

            if ( s_ConfigInfo.ServerCachedSize > 0
                 && s_ConfigInfo.ServerBufferSize > 0
                 && s_ConfigInfo.ServerManageThreadPoolSize > 0
                && s_ConfigInfo.ServerSendThreadPoolSize > 0
                && s_ConfigInfo.ServerReceiveThreadPoolSize > 0
                && s_ConfigInfo.ServerProcessThreadPoolSize > 0
                && s_ConfigInfo.ServerMaxClients > 0
                && s_ConfigInfo.ServerOutTimeInterval >= 0 )
            {
                configServer.SetServerNetConfig( (int)s_ConfigInfo.ServerCachedSize
                    , (int)s_ConfigInfo.ServerBufferSize
                    , (int)s_ConfigInfo.ServerManageThreadPoolSize
                    , (int)s_ConfigInfo.ServerSendThreadPoolSize
                    , (int)s_ConfigInfo.ServerReceiveThreadPoolSize
                    , (int)s_ConfigInfo.ServerProcessThreadPoolSize
                    , (int)s_ConfigInfo.ServerMaxClients
                    , (int)s_ConfigInfo.ServerOutTimeInterval );
            }


            if ( s_ConfigInfo.ClientCachedSize > 0
                && s_ConfigInfo.ClientBufferSize > 0
                && s_ConfigInfo.ClientManageThreadPoolSize > 0
                && s_ConfigInfo.ClientSendThreadPoolSize > 0
                && s_ConfigInfo.ClientReceiveThreadPoolSize > 0
                && s_ConfigInfo.ClientProcessThreadPoolSize > 0
                && s_ConfigInfo.ClientOutTimeInterval >= 0 )
            {
                configServer.SetClientNetConfig( (int)s_ConfigInfo.ClientCachedSize
                    , (int)s_ConfigInfo.ClientBufferSize
                    , (int)s_ConfigInfo.ClientManageThreadPoolSize
                    , (int)s_ConfigInfo.ClientSendThreadPoolSize
                    , (int)s_ConfigInfo.ClientReceiveThreadPoolSize
                    , (int)s_ConfigInfo.ClientProcessThreadPoolSize
                    , (int)s_ConfigInfo.ClientOutTimeInterval );
            }
        }