forked from uroni/urbackup_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceAcceptor.h
43 lines (31 loc) · 908 Bytes
/
ServiceAcceptor.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
#include <vector>
#include <string>
#include "socket_header.h"
#include "Interface/Thread.h"
#include "Interface/Pipe.h"
#include "Server.h"
class CServiceWorker;
class IService;
class CServiceAcceptor : public IThread
{
public:
CServiceAcceptor(IService * pService, std::string pName, unsigned short port, int pMaxClientsPerThread, IServer::BindTarget bindTarget);
~CServiceAcceptor();
void operator()(void);
private:
void AddToWorker(SOCKET pSocket, const std::string& endpoint);
bool init_socket_v4(unsigned short port, IServer::BindTarget bindTarget);
bool init_socket_v6(unsigned short port, IServer::BindTarget bindTarget);
std::vector<CServiceWorker*> workers;
SOCKET s;
SOCKET s_v6;
std::string name;
IService * service;
IPipe *exitpipe;
#ifndef _WIN32
int xpipe[2];
#endif
bool do_exit;
bool has_error;
int maxClientsPerThread;
};