-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPushServer.h
More file actions
107 lines (91 loc) · 2.22 KB
/
Copy pathPushServer.h
File metadata and controls
107 lines (91 loc) · 2.22 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef _PushServer_H_
#define _PUshServer_H_
#include <iostream>
#include <atomic>
#include "servant/Application.h"
#include "OuterFactoryImp.h"
#include "Functor.h"
#include "util/tc_timeout_queue.h"
//
using namespace tars;
/**
* 推送服务
**/
class PushServer : public Application
{
public:
/**
*
**/
virtual ~PushServer() {};
/**
*
**/
virtual void initialize();
/**
*
**/
virtual void destroyApp();
/**
* 初始化所有线程
*/
void initialThread();
/**
* 结束所有线程
*/
void destroyThread();
public:
/*
* 配置变更,重新加载配置
*/
bool reloadSvrConfig(const string &command, const string ¶ms, string &result);
/*
* 清除在线玩家状态
* params : 指定在线玩家uid,如果为-1,则表示清除所有在线玩家
* example -> CleanOnlineUser -1 or CleanOnlineUser 123456
*/
bool cleanOnlineUser(const string &command, const string ¶ms, string &result);
/*
* 服务器维护
* params : 分钟数
* example -> ServerUpdate 5
*/
bool serverUpdate(const string &command, const string ¶ms, string &result);
/**
* 零点在线状态重置
*/
bool dailyReset(const string &command, const string ¶ms, string &result);
/**
* 打印在线用户信息
*/
bool printOnlineUsers(const string &command, const string ¶ms, string &result);
/**
* 打印机器人信息
*/
bool printOnlineRobots(const string &command, const string ¶ms, string &result);
public:
/**
* 初始化外部接口对象
**/
int initOuterFactory();
/**
* 取外部接口对象
**/
OuterFactoryImpPtr getOuterFactoryPtr()
{
return _pOuter;
}
private:
//外部接口对象
OuterFactoryImpPtr _pOuter;
//定时处理对象
Functor _functor;
//线程池
TC_ThreadPool _tpool;
//锁,用于保护连接安全
TC_ThreadMutex m_ThreadMutex;
};
////
extern PushServer g_app;
////////////////////////////////////////////
#endif