forked from qdaxb/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconnectionmanager.h
More file actions
37 lines (37 loc) · 937 Bytes
/
connectionmanager.h
File metadata and controls
37 lines (37 loc) · 937 Bytes
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
//****************************************************
// Author: Axb - [email protected]
// Create Time: 2013-02-20 10:18
// Filename: ../include/connectionmanager.h
// Description:
//****************************************************
#ifndef _CONNECTIONMANAGER_H_
#define _CONNECTIONMANAGER_H_
#include <map>
using namespace std;
class ServerContext;
class HttpConnection;
class ConnectionManager{
public:
static ConnectionManager* getInstance()
{
if(instance==0)
{
instance=new ConnectionManager();
}
return instance;
}
ConnectionManager()
{
conns=new map<int,HttpConnection*>();
}
HttpConnection* create(int key);
HttpConnection* get(int key);
void release(int key);
void setServerContext(ServerContext *context){this->context=context;};
int size();
protected:
ServerContext *context;
static ConnectionManager* instance;
map<int,HttpConnection*> *conns;
};
#endif