-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathframe_netthread.h
74 lines (52 loc) · 1.44 KB
/
frame_netthread.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
/*
* frame_netthread.h
*
* Created on: 2012-11-1
* Author: jimm
*/
#ifndef FRAME_NETTHREAD_H_
#define FRAME_NETTHREAD_H_
#include "common/common_singleton.h"
#include "common/common_thread.h"
#include "common/common_message.h"
#include "frame_namespace.h"
#include "frame_typedef.h"
#include "frame_errordef.h"
#include "frame_logengine.h"
#include "frame_socket.h"
#include "frame_baseconfig.h"
#include "frame_epoll.h"
FRAME_NAMESPACE_BEGIN
//enum enmSocketType
//{
// enmSocketType_invalid = 0,
// enmSocketType_listen = 1, //监听socket
// enmSocketType_common = 2, //普通socket
//};
//最大的服务器类型个数
//#define MAX_PEERTYPE_COUNT 64
#define RECONNECT_TIME 10//(s)
class CFrameNetThread// : public CThread
{
public:
CFrameNetThread();
virtual ~CFrameNetThread();
int32_t Initialize();
int32_t Resume();
int32_t Uninitialize();
bool Execute();
CEpoll *GetEpollObj();
protected:
int32_t MessagePump();
int32_t SendMessage();
int32_t HandleTimeOutEvent();
protected:
CEpoll m_stEpoll;
int64_t m_nReconnectTime;
int64_t m_nLastConnectTime;
};
#define CREATE_FRAMENETTHREAD_INSTANCE CSingleton<CFrameNetThread>::CreateInstance
#define g_FrameNetThread CSingleton<CFrameNetThread>::GetInstance()
#define DESTROY_FRAMENETTHREAD_INSTANCE CSingleton<CFrameNetThread>::DestroyInstance
FRAME_NAMESPACE_END
#endif /* FRAME_NETTHREAD_H_ */