-
Notifications
You must be signed in to change notification settings - Fork 0
/
Conf.h
76 lines (57 loc) · 1.85 KB
/
Conf.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* File: Conf.h
* Author: try
*
* Created on 2011年6月11日, 上午10:59
*/
#ifndef CONF_H
#define CONF_H
#include "resources.h"
#include "event/IEventListener.h"
#include "logger.h"
#include <string>
/**
* HTTP Server配置
*/
class HttpHandlerFactory;
class Conf {
public:
/** 处理请求的子进程数量, 默认值在WORK_PROCESS_COUNT中定义 */
unsigned int workProcessCount;
/** 请求读缓冲区大小, 默认值在HTTP_REQUEST_BUFFER_SIZE中定义 */
unsigned int requestBufferSize;
/** 请求响应写缓冲区大小,默认值在HTTP_RESPONSE_BUFFER_SIZE中定义 */
unsigned int responseBufferSize;
/** 允许请求行最大字节数量, 默认:REQUEST_LINE_MAX_BYTES */
unsigned int requestLineMaxBytes;
/** 连接空闲超时时间, 单位:秒 */
double idleTimeout;
/** HttpHandlerPool中最多保留多少个HttpHandler, 默认值:POOL_MAX_HTTP_HANDLER_COUNT */
unsigned int poolMaxHttpHandlerCount;
/** HttpHandler工厂 */
HttpHandlerFactory* handlerFactory;
/** 各种事件监听器,注意:监听有可能在父进程中执行,也有可能在子进程中执行 */
IEventListener* eventListener;
/** log config file**/
string log4cpluscfg;
/* Server port */
int listenport;
public:
Conf():
workProcessCount(WORK_PROCESS_COUNT),
requestBufferSize(HTTP_REQUEST_BUFFER_SIZE),
responseBufferSize(HTTP_RESPONSE_BUFFER_SIZE),
requestLineMaxBytes(REQUEST_LINE_MAX_BYTES),
idleTimeout(IDLE_TIMEOUT),
poolMaxHttpHandlerCount(POOL_MAX_HTTP_HANDLER_COUNT),
handlerFactory(NULL),
eventListener(NULL),
log4cpluscfg(""),
listenport(80)
{}
void initLog(){
INIT_LOG(log4cpluscfg);
}
virtual ~Conf(){}
};
#endif /* CONF_H */