Commit 03f2fff6 authored by jan.koester's avatar jan.koester
Browse files

test

parent 9dbc8e6d
Loading
Loading
Loading
Loading
+7 −7
Changes for src/event/iocp.cpp: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -253,12 +253,14 @@ namespace netplus {
					continue;
				}

				if (!pClientContext->cltmtx.try_lock())
					continue;

				try {
					auto& curCon = pClientContext->CurCon;					

					switch (pClientContext->State) {
						case IO_WRITE_STATE: {
							std::lock_guard<std::mutex> lock(pClientContext->cltmtx);
							
							eargs->event->ResponseEvent(curCon, tid, args);

							ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE;
@@ -269,7 +271,6 @@ namespace netplus {
								pClientContext->State = IO_READ_STATE;
						}break;
						case IO_READ_STATE: {
							std::lock_guard<std::mutex> lock(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);
@@ -287,15 +288,14 @@ namespace netplus {
				} catch (NetException& e) {
					std::cerr << e.what() << std::endl;
					if (e.getErrorType() != NetException::Note) {
						continue;
					}
						eargs->evpoll->RemoveFromClientList(pClientContext);
					}
					
				} catch (...) {
					std::cerr << "unknown error close coonection !" << std::endl;
					eargs->evpoll->RemoveFromClientList(pClientContext);
					continue;
				}
				
				pClientContext->cltmtx.unlock();
			} // for
		}
	};