正在显示
1 个修改的文件
包含
59 行增加
和
0 行删除
src/server/spserver/spiocpserver.hpp
0 → 100644
1 | +/* | |
2 | + * Copyright 2008 Stephen Liu | |
3 | + * For license terms, see the file COPYING along with this library. | |
4 | + */ | |
5 | + | |
6 | +#ifndef __spiocpserver_hpp__ | |
7 | +#define __spiocpserver_hpp__ | |
8 | + | |
9 | +#include "spthread.hpp" | |
10 | + | |
11 | +class SP_HandlerFactory; | |
12 | +class SP_IOChannelFactory; | |
13 | +class SP_Session; | |
14 | +class SP_Executor; | |
15 | + | |
16 | +class SP_IocpServer { | |
17 | +public: | |
18 | + SP_IocpServer( const char * bindIP, int port, SP_HandlerFactory * handlerFactory ); | |
19 | + ~SP_IocpServer(); | |
20 | + | |
21 | + void setTimeout( int timeout ); | |
22 | + void setMaxConnections( int maxConnections ); | |
23 | + void setMaxThreads( int maxThreads ); | |
24 | + void setReqQueueSize( int reqQueueSize, const char * refusedMsg ); | |
25 | + void setIOChannelFactory( SP_IOChannelFactory * ioChannelFactory ); | |
26 | + | |
27 | + void shutdown(); | |
28 | + int isRunning(); | |
29 | + int run(); | |
30 | + void runForever(); | |
31 | + | |
32 | +private: | |
33 | + SP_HandlerFactory * mHandlerFactory; | |
34 | + SP_IOChannelFactory * mIOChannelFactory; | |
35 | + | |
36 | + HANDLE mCompletionPort; | |
37 | + char mBindIP[ 64 ]; | |
38 | + int mPort; | |
39 | + int mIsShutdown; | |
40 | + int mIsRunning; | |
41 | + | |
42 | + int mTimeout; | |
43 | + int mMaxThreads; | |
44 | + int mMaxConnections; | |
45 | + int mReqQueueSize; | |
46 | + char * mRefusedMsg; | |
47 | + | |
48 | + static sp_thread_result_t SP_THREAD_CALL acceptThread( void * arg ); | |
49 | + | |
50 | + static sp_thread_result_t SP_THREAD_CALL eventLoop( void * arg ); | |
51 | + | |
52 | + int start(); | |
53 | + | |
54 | + static void sigHandler( int, short, void * arg ); | |
55 | + | |
56 | + static void outputCompleted( void * arg ); | |
57 | +}; | |
58 | + | |
59 | +#endif | ... | ... |
请
注册
或
登录
后发表评论