-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChatManager.h
41 lines (35 loc) · 884 Bytes
/
ChatManager.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
#pragma once
#ifndef CHATMANAGER
#define CHATMANAGER
#include "stdafx.h"
#include<mutex>
#include<condition_variable>
#include "ChatServer.h"
#include "Socket.h"
class chatServer;
class Socket;
class chatManager {
public:
chatManager();
static void startListen(void* p);
static void WINAPI socketWorkerThread(void *p);
HANDLE getIOCP();
void spawnWorkerThreads();
void startChat();
void onDisconnect(Socket *s);
void sendToAll(Packet & pkt, Socket* s);
void HandlePacket(Socket* s);
void chatBoard(Packet& pkt, Socket *s);
void newConnection(Packet& pkt, Socket* s);
void assignClient(Socket *s) {
activeClients.push_back(s);
}
void sendPM(Packet &, Socket* s);
void sendList(Socket *s);
private:
chatServer *server;
std::vector<std::thread *> threads;
std::vector<Socket*> activeClients;
std::mutex mMutex;
};
#endif