Example #1
0
        public AresServer(IServerConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config", "Server configuration cannot be null.");
            }

            this.config = config;

            ticklength = TimeSpan.FromSeconds(1);

            stats    = new AresServerStats();
            users    = new AresClientList();
            channels = new AresChannels(this);
            plugins  = new PluginHost(this);

            idpool = new SortedStack <UInt16>();
            idpool.SetSort((a, b) => (a - b));

            pending     = new List <PendingConnection>();
            flood_rules = new List <IFloodRule>();

            history = new History(this);
            history.Load();
        }
Example #2
0
        public AresServer(AresServerConfig config)
        {
            this.Config = config ??
                          throw new ArgumentNullException("config", "Server configuration cannot be null.");

            ticklength = TimeSpan.FromSeconds(1);

            Stats = new AresServerStats();
            Users = new ModelList <IClient>();

            Channels = new AresChannels {
                Server   = this,
                Channels = Persistence.LoadModel <ModelList <AresChannel> >(Path.Combine(config.Directories.AppData, "channels.json"))
            };

            if (Channels.Channels.Count == 0)
            {
                Channels.LoadFromDatFile();
            }

            PluginHost = new ServerPluginHost(this);

            idpool = new SortedStack <ushort>();
            idpool.SetSort((a, b) => (a - b));

            pending     = new List <PendingConnection>();
            flood_rules = new List <IFloodRule>();

            History = Persistence.LoadModel <AresUserHistory>(Path.Combine(config.Directories.AppData, "history.json"));
            History.Admin.Load(this);

            Logging.WriteLines(
                LogLevel.Info,
                "AresServer",
                new[] {
                "Chatroom configuration applied.",
                "Listen Port: {0}",
                "Using UDP Channels: {1}",
                "Allow TCP Connections: {2}",
                "Allow WebSocket Connections: {3}",
                "Listen for TLS Connections: {4}"
            },
                config.Port,
                config.UseUdpSockets,
                config.UseTcpSockets,
                config.UseWebSockets,
                config.UseTlsSockets);
        }