Commit 5e677bc7 authored by jan.koester's avatar jan.koester
Browse files

Merge branch 'main' of git.tuxist.de:jan.koester/libnetplus

parents a958df24 cd431651
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=/usr/local
Install Directory=
Runtime=Host System

[Project]
+2 −2
Original line number Diff line number Diff line
@@ -3,5 +3,5 @@ include(CMakeFindDependencyMacro)
include(${CMAKE_CURRENT_LIST_DIR}/libnetplusTargets.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/libnetplusVersion.cmake)

set(NETPLUS_INCLUDE_DIR   "@CMAKE_INSTALL_INCLUDEDIR@" )
set(NETPLUS_CONFIG_DIR    "@CMAKE_INSTALL_PREFIX@/@ConfigPackageLocation@" )
 No newline at end of file
set(NETPLUS_INCLUDE_DIR   "${CMAKE_CURRENT_LIST_DIR}/../../../include")
set(NETPLUS_CONFIG_DIR    "${CMAKE_CURRENT_LIST_DIR}" )
 No newline at end of file
+2 −7
Original line number Diff line number Diff line
@@ -144,10 +144,9 @@ namespace netplus {
        }

        int waitEventHandler(int timeout) {
            NetException exception;
            int evn = epoll_wait(_pollFD,_Events, _ServerSocket->getMaxconnections(), timeout);
            if (evn < 0 ) {
                NetException exception;

                char str[255];
                strerror_r_netplus(errno,str,255);

@@ -346,7 +345,7 @@ namespace netplus {
                                    continue;
                                default:
                                    NetException  e;
                                    e[NetException::Error] << "EventWorker: Request type not kwon!";
                                    e[NetException::Error] << "EventWorker: Request type not known!";
                                    throw e;
                            }
                        }catch(NetException& e){
@@ -355,7 +354,6 @@ namespace netplus {
                                    continue;
                                default:
                                    pollptr.CloseEventHandler(i,tid,args);
                                    throw e;
                            }
                        }
                    }
@@ -455,15 +453,12 @@ MAINWORKERLOOP:
           }
        }

        std::cout << "start" << std::endl;
        for(auto i = threadpool.begin(); i!=threadpool.end(); ++i){
            i->join();
        }

        close(_pollFD);

        std::cout << "end" << std::endl;

        if (event::_Restart) {
            event::_Restart = false;
            goto MAINWORKERLOOP;
+6 −6
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ namespace netplus {
			}
		}

		void AcceptConnection(int tid, ULONG_PTR args) {
		void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx,int tid, ULONG_PTR args) {
			g_amtx.lock();
			client* pClientContext = new client(g_eventapi);
		
@@ -119,7 +119,7 @@ namespace netplus {
				pClientContext->CurCon->csock = new tcp;

			try {
				g_serversocket->accept(pClientContext->CurCon->csock);
				g_serversocket->accept(lpfnAcceptEx,pClientContext->CurCon->csock);

				pClientContext->CurCon->csock->setFlag(FIONBIO, 0);

@@ -265,7 +265,7 @@ namespace netplus {
				}

				try {
					if (pClientContext->CurCon && !((con*)pClientContext->CurCon)->SendData.empty()) {
					if (!pClientContext->CurCon->SendData.empty()) {

						dwFlags = 0;

@@ -286,9 +286,9 @@ namespace netplus {
					} else {
						dwFlags = 0;

						std::shared_ptr<char[]> buf(new char[16384], std::default_delete<char[]>());
						std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>());
						//Get the data.
						ret = pClientContext->CurCon->csock->recvData(buf.get(), 16384, 0);
						ret = pClientContext->CurCon->csock->recvData(buf.get(), BLOCKSIZE, 0);

						if (ret > 0) {
							pClientContext->CurCon->RecvData.append(buf.get(), ret);
@@ -388,7 +388,7 @@ namespace netplus {
				WSAEnumNetworkEvents(_ServerSocket->fd(), g_hAcceptEvent, &WSAEvents);
				if ((WSAEvents.lNetworkEvents & FD_ACCEPT) && (0 == WSAEvents.iErrorCode[FD_ACCEPT_BIT])) {
					try {
						evpoll.AcceptConnection(0, args);
						evpoll.AcceptConnection(lpfnAcceptEx,0, args);
					} catch (NetException& e) {
						std::cerr << e.what() << std::endl;
					}
+2 −6
Original line number Diff line number Diff line
@@ -154,8 +154,6 @@ void netplus::tcp::accept(socket *csock){

    copyAddrInfo(&csock->_SocketInfo,_SocketInfo,_SocketInfoLen);

    socklen_t len=0;

    *csock=::accept(_Socket,((struct addrinfo *)csock->_SocketInfo)->ai_addr,&((struct addrinfo *)csock->_SocketInfo)->ai_addrlen);
    
    if(csock->_Socket<0){
@@ -186,7 +184,7 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){
    if(rval<0){
        int etype=NetException::Error;

        if(errno==EAGAIN)
        if(errno==EAGAIN || errno==EWOULDBLOCK)
            etype=NetException::Note;

        char errstr[512];
@@ -204,8 +202,6 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){
size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){
    NetException exception;

    socklen_t recvaddr=0;

    int recvsize=::recv(_Socket,
                            data,
                            size,
@@ -214,7 +210,7 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){
    if(recvsize<0){
        int etype=NetException::Error;

        if(errno==EAGAIN)
        if(errno==EAGAIN || errno==EWOULDBLOCK)
            etype=NetException::Note;


Loading