Commit 92556c33 authored by jan.koester's avatar jan.koester
Browse files

test

parent 5e677bc7
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ namespace netplus {
		}

		void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx,int tid, ULONG_PTR args) {
			g_amtx.lock();
			client* pClientContext = new client(g_eventapi);
		
			if (g_serversocket->_Type == TCP)
@@ -130,13 +129,10 @@ namespace netplus {
			} catch (NetException& e) {
				delete pClientContext->CurCon->csock;
				RemoveFromClientList(pClientContext);
				g_amtx.unlock();
				throw e;
			}
			g_eventapi->ConnectEvent(pClientContext->CurCon, tid, args);

			g_amtx.unlock();

			std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>());

			size_t recv = pClientContext->CurCon->csock->recvData(buf.get(), BLOCKSIZE, 0);			
+8 −8
Original line number Diff line number Diff line
@@ -195,18 +195,18 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){
    buf.len = size;

    DWORD dwFlags = 0;
SENDDATA:
    SOCKET rval=::WSASend(_Socket,&buf,1,nullptr,flags,&_Overlapped,nullptr);

    if(rval == SOCKET_ERROR){
        DWORD lerror=GetLastError();
        
        int etype = NetException::Error;

        if (lerror == WSA_IO_PENDING) {
            Sleep(1);
            goto SENDDATA;
            etype = NetException::Note;
        }

        exception[NetException::Error] << "Socket senddata failed on Socket: " << (int) _Socket
        exception[etype] << "Socket senddata failed on Socket: " << (int) _Socket
                                       << " ErrorMsg: " << lerror;
        throw exception;
    }
@@ -222,18 +222,18 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){
    buf.len =        size;

    DWORD dwFlags = 0;
RECVDATA:
    int recvsize=::WSARecv(_Socket, &buf, 1,nullptr,(LPDWORD) &flags, &_Overlapped, nullptr);

    if(recvsize==SOCKET_ERROR){
        DWORD lerror = GetLastError();

        int etype = NetException::Error;

        if (lerror == WSA_IO_PENDING) {
            Sleep(1);
            goto RECVDATA;
            etype = NetException::Note;
        }

        exception[NetException::Error] << "Socket recvdata failed on Socket: " << (int)_Socket
        exception[etype] << "Socket recvdata failed on Socket: " << (int)_Socket
                                       << " ErrorMsg: " << lerror;
        throw exception;
    }