-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.h
More file actions
31 lines (24 loc) · 1002 Bytes
/
config.h
File metadata and controls
31 lines (24 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef CONFIG_H
#define CONFIG_H
#include <string>
// 前置声明,不需要包含完整的 webserver.h,减少编译依赖
class WebServer;
class Config {
public:
Config();
~Config() = default; // 使用 C++11 default 析构
// 解析命令行参数
void parse_arg(int argc, char *argv[]);
// 基础配置参数 (C++11 类内初始化,确保默认安全) ---
int PORT{9006}; // 端口号,默认9006
int LOGWrite{0}; // 日志写入方式,默认同步
int TRIGMode{0}; // 触发组合模式,默认 listenfd LT + connfd LT
int LISTENTrigmode{0}; // listenfd触发模式
int CONNTrigmode{0}; // connfd触发模式
int OPT_LINGER{0}; // 优雅关闭链接
int sql_num{16}; // 数据库连接池数量,增加以支持高并发
int thread_num{16}; // 线程池内的线程数量,提升并发处理能力
int close_log{0}; // 是否关闭日志
int actor_model{0}; // 并发模型选择 (0: Proactor, 1: Reactor)
};
#endif