-
Notifications
You must be signed in to change notification settings - Fork 1
/
serviceLoop.h
executable file
·74 lines (55 loc) · 1.41 KB
/
serviceLoop.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
//
//---------------------------------------------------------------------------
#ifndef serviceLoopH
#define serviceLoopH
//---------------------------------------------------------------------------
struct User;
//---------------------------------------------------------------------------
class clsServiceLoop {
private:
struct AcceptedSocket {
#ifdef _WIN32
SOCKET s;
#else
int s;
#endif
sockaddr_storage addr;
AcceptedSocket *next;
};
uint64_t iLstUptmTck;
#ifdef _WIN32
CRITICAL_SECTION csAcceptQueue;
#else
pthread_mutex_t mtxAcceptQueue;
#endif
AcceptedSocket *AcceptedSocketsS, *AcceptedSocketsE;
#ifndef _WIN32
int iSIG;
siginfo_t info;
sigset_t sst;
struct timespec zerotime;
#endif
char msg[1024];
void AcceptUser(AcceptedSocket * AccptSocket);
protected:
public:
static clsServiceLoop * mPtr;
clsServiceLoop();
~clsServiceLoop();
#ifdef _WIN32
static UINT_PTR srvLoopTimer;
#endif
double dLoggedUsers, dActualSrvLoopLogins;
uint32_t iLastSendRest, iSendRestsPeak, iLastRecvRest, iRecvRestsPeak, iLoopsForLogins;
bool bRecv;
#ifdef _WIN32
void AcceptSocket(const SOCKET &s, const sockaddr_storage &addr);
#else
void AcceptSocket(const int &s, const sockaddr_storage &addr);
#endif
void ReceiveLoop();
void SendLoop();
void Looper();
};
//---------------------------------------------------------------------------
#endif