Loading src/event/iocp.cpp +3 −9 Changes for src/event/iocp.cpp: 3 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ namespace netplus { } void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx, int tid, ULONG_PTR args) { std::shared_ptr<client> pClientContext(new client(g_eventapi),delete client); std::shared_ptr<client> pClientContext(new client(g_eventapi), std::default_delete<client>()); if (g_serversocket->_Type == TCP) pClientContext->CurCon->csock = std::make_shared <tcp>(); Loading Loading @@ -262,8 +262,7 @@ namespace netplus { switch (pClientContext->State) { case IO_WRITE_STATE: { pClientContext->cltmtx.lock(); std::lock_guard<std::mutex> clock(pClientContext->cltmtx); eargs->event->ResponseEvent(curCon, tid, args); ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE; Loading @@ -272,11 +271,9 @@ namespace netplus { curCon->SendData.resize(ret); if (curCon->SendData.empty()) pClientContext->State = IO_READ_STATE; pClientContext->cltmtx.unlock(); }break; case IO_READ_STATE: { pClientContext->cltmtx.lock(); std::lock_guard<std::mutex> clock(pClientContext->cltmtx); std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>()); size_t recv = curCon->csock->recvData(buf.get(), BLOCKSIZE, 0); curCon->RecvData.append(buf.get(), recv); Loading @@ -284,7 +281,6 @@ namespace netplus { eargs->event->RequestEvent(curCon, tid, args); if (!curCon->SendData.empty()) pClientContext->State = IO_WRITE_STATE; pClientContext->cltmtx.unlock(); }break; case IO_CLOSE_STATE: { eargs->evpoll->RemoveFromClientList(pClientContext); Loading @@ -296,13 +292,11 @@ namespace netplus { if (e.getErrorType() != NetException::Note) { pClientContext->State = IO_CLOSE_STATE; } pClientContext->cltmtx.unlock(); continue; } catch (...) { std::cerr << "unknown error close coonection !" << std::endl; pClientContext->State = IO_CLOSE_STATE; pClientContext->cltmtx.unlock(); continue; } Loading Loading
src/event/iocp.cpp +3 −9 Changes for src/event/iocp.cpp: 3 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ namespace netplus { } void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx, int tid, ULONG_PTR args) { std::shared_ptr<client> pClientContext(new client(g_eventapi),delete client); std::shared_ptr<client> pClientContext(new client(g_eventapi), std::default_delete<client>()); if (g_serversocket->_Type == TCP) pClientContext->CurCon->csock = std::make_shared <tcp>(); Loading Loading @@ -262,8 +262,7 @@ namespace netplus { switch (pClientContext->State) { case IO_WRITE_STATE: { pClientContext->cltmtx.lock(); std::lock_guard<std::mutex> clock(pClientContext->cltmtx); eargs->event->ResponseEvent(curCon, tid, args); ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE; Loading @@ -272,11 +271,9 @@ namespace netplus { curCon->SendData.resize(ret); if (curCon->SendData.empty()) pClientContext->State = IO_READ_STATE; pClientContext->cltmtx.unlock(); }break; case IO_READ_STATE: { pClientContext->cltmtx.lock(); std::lock_guard<std::mutex> clock(pClientContext->cltmtx); std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>()); size_t recv = curCon->csock->recvData(buf.get(), BLOCKSIZE, 0); curCon->RecvData.append(buf.get(), recv); Loading @@ -284,7 +281,6 @@ namespace netplus { eargs->event->RequestEvent(curCon, tid, args); if (!curCon->SendData.empty()) pClientContext->State = IO_WRITE_STATE; pClientContext->cltmtx.unlock(); }break; case IO_CLOSE_STATE: { eargs->evpoll->RemoveFromClientList(pClientContext); Loading @@ -296,13 +292,11 @@ namespace netplus { if (e.getErrorType() != NetException::Note) { pClientContext->State = IO_CLOSE_STATE; } pClientContext->cltmtx.unlock(); continue; } catch (...) { std::cerr << "unknown error close coonection !" << std::endl; pClientContext->State = IO_CLOSE_STATE; pClientContext->cltmtx.unlock(); continue; } Loading