왠지 버그 고쳐짐..
This commit is contained in:
@@ -364,8 +364,9 @@ void ClientManager::run() {
|
|||||||
getUserList();
|
getUserList();
|
||||||
else if (tokens[0] == "/roomlist")
|
else if (tokens[0] == "/roomlist")
|
||||||
getRoomList();
|
getRoomList();
|
||||||
else if (tokens[0] == "/exit")
|
else if (tokens[0] == "/exit") {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else if (inRoom_) {
|
else if (inRoom_) {
|
||||||
std::string message;
|
std::string message;
|
||||||
for (int i = 0; i < tokens.size(); i++)
|
for (int i = 0; i < tokens.size(); i++)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ IOCP::~IOCP() {
|
|||||||
void IOCP::destruct() {
|
void IOCP::destruct() {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
uint64_t u = 1;
|
uint64_t u = 1;
|
||||||
::write(epollDetroyerFd_, &u, sizeof(uint64_t));
|
::write(epollDetroyerFd, &u, sizeof(uint64_t));
|
||||||
close(epollfd_);
|
close(epollfd_);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,8 +253,8 @@ public:
|
|||||||
log::critical("CreateIoCompletionPort()");
|
log::critical("CreateIoCompletionPort()");
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
epollfd_ = ::epoll_create(1);
|
epollfd_ = ::epoll_create(1);
|
||||||
epollDetroyerFd_ = ::eventfd(0, EFD_NONBLOCK);
|
epollDetroyerFd = ::eventfd(0, EFD_NONBLOCK);
|
||||||
::epoll_ctl(epollfd_, EPOLL_CTL_ADD, epollDetroyerFd_, NULL);
|
::epoll_ctl(epollfd_, EPOLL_CTL_ADD, epollDetroyerFd, NULL);
|
||||||
#endif
|
#endif
|
||||||
auto boundFunc = [callback = std::move(callback)](ThreadPool* __IOCPThread, IOCPPASSINDATA* data) mutable {
|
auto boundFunc = [callback = std::move(callback)](ThreadPool* __IOCPThread, IOCPPASSINDATA* data) mutable {
|
||||||
callback(__IOCPThread, data);
|
callback(__IOCPThread, data);
|
||||||
@@ -285,6 +285,10 @@ public:
|
|||||||
int recv(IOCPPASSINDATA* data, int bufferCount);
|
int recv(IOCPPASSINDATA* data, int bufferCount);
|
||||||
int send(IOCPPASSINDATA* data, int bufferCount, int __flags, bool client = false);
|
int send(IOCPPASSINDATA* data, int bufferCount, int __flags, bool client = false);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
int epollDetroyerFd = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct WSAManager wsaManager;
|
struct WSAManager wsaManager;
|
||||||
ThreadPool* IOCPThread_;
|
ThreadPool* IOCPThread_;
|
||||||
@@ -293,7 +297,6 @@ private:
|
|||||||
HANDLE completionPort_ = INVALID_HANDLE_VALUE;
|
HANDLE completionPort_ = INVALID_HANDLE_VALUE;
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
int epollfd_ = -1;
|
int epollfd_ = -1;
|
||||||
int epollDetroyerFd_ = -1;
|
|
||||||
std::unordered_map<std::shared_ptr<TCPSocket>, std::mutex> writeMutex;
|
std::unordered_map<std::shared_ptr<TCPSocket>, std::mutex> writeMutex;
|
||||||
std::unordered_map<std::shared_ptr<TCPSocket>, std::queue<IOCPPASSINDATA*>> writeBuffer;
|
std::unordered_map<std::shared_ptr<TCPSocket>, std::queue<IOCPPASSINDATA*>> writeBuffer;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user