Commit 82e319a2 authored by jan.koester's avatar jan.koester
Browse files

test

parent c4fc2cfd
Loading
Loading
Loading
Loading
+14 −6
Changes for src/event/iocp.cpp: 14 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -115,14 +115,23 @@ namespace netplus {
			}

			g_eventapi->ConnectEvent(*pClientContext->CurCon, tid, args);

			try {
			buffer buf(0);
			for (;;) {
				try {
					size_t recv = pClientContext->CurCon->csock->recvData(buf, 0);
			} catch (NetException& e) {
					break;
				}
				catch (NetException& e) {
					if (e.getErrorType() == NetException::Note) {
						continue;
					}
					else if (e.getErrorType() == NetException::Error) {
						std::cerr << e.what() << std::endl;
				if (e.getErrorType() != NetException::Note)
					throw e;
						g_eventapi->DisconnectEvent(*pClientContext->CurCon, tid, args);
						delete pClientContext;
						return;
					}
				};
			}
		}

@@ -295,7 +304,6 @@ namespace netplus {
						}break;
					}
				} catch (NetException& e) {
					std::cout << e.getErrorType() << std::endl;
					if (e.getErrorType() != NetException::Note) {
						std::cerr << e.what() << std::endl;
						pClientContext->cltmtx.lock();
+1 −1
Changes for src/exception.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ namespace netplus {
        
        const std::string &what() const;
        
        enum Type {Note,Warning,Error,Critical,Close};
        enum Type {Note=0,Warning=-1,Error=-2,Critical=-3,Close=-4};
        
        NetException& append(const std::string& src);
        NetException& operator[](int errtype);
+5 −5
Changes for src/windows/tcp.cpp: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -246,15 +246,15 @@ size_t netplus::tcp::recvData(buffer &data,int flags){
    if (rval == SOCKET_ERROR) {
        switch (WSAGetLastError()) {
        case WSAEWOULDBLOCK:
            throw exception[NetException::Note] << "Socket senddata failed WSAWOULDBLOCK on Socket: " << (int)_Socket;
            throw exception[NetException::Note] << "Socket recvData failed WSAWOULDBLOCK on Socket: " << (int)_Socket;
        case WSA_IO_PENDING:
            throw exception[NetException::Note] << "Socket senddata failed WSA_IO_PENDING on Socket: " << (int)_Socket;
            throw exception[NetException::Note] << "Socket recvData failed WSA_IO_PENDING on Socket: " << (int)_Socket;
        case WSAENOTCONN:
            throw exception[NetException::Error] << "Socket senddata failed WSAENOTCONN on Socket: " << (int)_Socket;
            throw exception[NetException::Error] << "Socket recvData failed WSAENOTCONN on Socket: " << (int)_Socket;
        case WSAECONNRESET:
            throw exception[NetException::Error] << "Socket senddata failed WSAECONNRESET on Socket: " << (int)_Socket;
            throw exception[NetException::Error] << "Socket recvData failed WSAECONNRESET on Socket: " << (int)_Socket;
        default:
            throw exception[NetException::Error] << "Socket senddata failed some Error on Socket: " << (int)_Socket;
            throw exception[NetException::Error] << "Socket recvData failed some Error on Socket: " << (int)_Socket;
        }
    }