Commit 6f20478c authored by jan.koester's avatar jan.koester
Browse files

test

parent 7277ca98
Loading
Loading
Loading
Loading
+24 −3
Changes for src/event/iocp.cpp: 24 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -227,16 +227,37 @@ namespace netplus {
					&pOverlapped,
					WSA_INFINITE);

				if (lpContext == 0) {
				if (!bReturn) {		
					DWORD dwError = GetLastError();
					if (dwError == WAIT_TIMEOUT) {
						if (eargs->timeout > 0) {
							std::this_thread::sleep_for(std::chrono::milliseconds(eargs->timeout));
						}
						continue;
					} else if (dwError == ERROR_OPERATION_ABORTED) {
						continue;
					} else {
						NetException exp;
						exp[NetException::Critical] << "GetQueuedCompletionStatus failed with error: " << dwError;
						throw exp;
					}
				}

				client *pClientContext = reinterpret_cast<client*>(lpContext);
				if(dwBytesTransfered == 0) {
					if (lpContext == 0) {
						NetException exp;
						exp[NetException::Critical] << "GetQueuedCompletionStatus returned zero bytes transferred and no context!";
						throw exp;
					}
					continue;
				}

				if (!bReturn && dwBytesTransfered == 0) {
				if (lpContext == 0) {
					continue;
				}

				client *pClientContext = reinterpret_cast<client*>(lpContext);

				pClientContext->cltmtx.lock();

				try {