Loading src/base64.cpp +1 −1 Changes for src/base64.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ void netplus::base64::clear(){ const netplus::base64 &netplus::base64::operator>>(std::vector<char> &src) const{ int val=0, valb=-8; unsigned long long val=0, valb=-8; for (char c : _data) { if (basis_64.find(c) == std::string::npos) break; Loading src/connection.h +1 −1 Changes for src/connection.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ namespace netplus { protected: con(); int lasteventime; time_t lasteventime; friend class poll; }; }; src/event/iocp.cpp +12 −12 Changes for src/event/iocp.cpp: 12 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -94,9 +94,6 @@ namespace netplus { exp[NetException::Error] << "AssociateWithIOCP fehlgeschlagen: Fehlercode " << err; throw exp; } pClientContext->CurCon->csock->_Overlapped.hEvent = WSACreateEvent(); } void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx, int tid, ULONG_PTR args) { Loading Loading @@ -263,7 +260,7 @@ namespace netplus { eargs->event->ResponseEvent(*curCon, tid, args); ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE; DWORD ret = 0; size_t ret = 0; buffer buf(curCon->SendData.data(),ssize); ret = curCon->csock->sendData(buf,0); Loading Loading @@ -298,20 +295,23 @@ namespace netplus { }break; } } catch (NetException& e) { if (e.getErrorType() != NetException::Note) { std::cerr << e.what() << std::endl; if (e.getErrorType() == NetException::Note) { continue; } pOverlapped->hEvent=0; pClientContext->cltmtx.lock(); eargs->event->DisconnectEvent(*pClientContext->CurCon, tid, args); // Close the socket WSACloseEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); delete pClientContext->CurCon->csock; delete pClientContext; PostQueuedCompletionStatus(eargs->eviocp, 0, 0, pOverlapped); } } catch (...) { std::cerr << "Eventworker unknown error !" << std::endl; pOverlapped->hEvent = 0; pClientContext->cltmtx.lock(); eargs->event->DisconnectEvent(*pClientContext->CurCon, tid, args); // Close the socket WSACloseEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); delete pClientContext->CurCon->csock; delete pClientContext; PostQueuedCompletionStatus(eargs->eviocp, 0, 0, pOverlapped); } } // for } Loading Loading @@ -381,7 +381,7 @@ namespace netplus { throw exp; } if (SOCKET_ERROR == WSAEventSelect(_ServerSocket->fd(), g_hAcceptEvent, FD_ACCEPT | FD_READ | FD_WRITE)) { if (SOCKET_ERROR == WSAEventSelect(_ServerSocket->fd(), g_hAcceptEvent, FD_ACCEPT)) { NetException exp; exp[NetException::Error] << "Error occurred while WSAEventSelect()."; WSACloseEvent(g_hAcceptEvent); Loading src/windows/tcp.cpp +6 −8 Changes for src/windows/tcp.cpp: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ else buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwsend = 0; Loading @@ -212,13 +212,12 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ int etype = NetException::Error; if(rval == SOCKET_ERROR){ DWORD lerror=GetLastError(); int lerror= WSAGetLastError(); if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; } exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket throw exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)dwsend; } Loading @@ -234,7 +233,7 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ WSABUF buf; buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; Loading @@ -243,13 +242,12 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int etype = NetException::Error; if (rval == SOCKET_ERROR) { DWORD lerror = GetLastError(); int lerror = WSAGetLastError(); if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; } exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket throw exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)dwBytes; Loading src/windows/udp.cpp +3 −3 Changes for src/windows/udp.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx,socket *csock) { ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -198,7 +198,7 @@ size_t netplus::udp::sendData(buffer &data, int flags) { else buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; DWORD dwFlags = 0; Loading Loading @@ -229,7 +229,7 @@ size_t netplus::udp::recvData(buffer &data, int flags) { WSABUF buf; buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; DWORD dwFlags = 0; Loading Loading
src/base64.cpp +1 −1 Changes for src/base64.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ void netplus::base64::clear(){ const netplus::base64 &netplus::base64::operator>>(std::vector<char> &src) const{ int val=0, valb=-8; unsigned long long val=0, valb=-8; for (char c : _data) { if (basis_64.find(c) == std::string::npos) break; Loading
src/connection.h +1 −1 Changes for src/connection.h: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -161,7 +161,7 @@ namespace netplus { protected: con(); int lasteventime; time_t lasteventime; friend class poll; }; };
src/event/iocp.cpp +12 −12 Changes for src/event/iocp.cpp: 12 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -94,9 +94,6 @@ namespace netplus { exp[NetException::Error] << "AssociateWithIOCP fehlgeschlagen: Fehlercode " << err; throw exp; } pClientContext->CurCon->csock->_Overlapped.hEvent = WSACreateEvent(); } void AcceptConnection(LPFN_ACCEPTEX lpfnAcceptEx, int tid, ULONG_PTR args) { Loading Loading @@ -263,7 +260,7 @@ namespace netplus { eargs->event->ResponseEvent(*curCon, tid, args); ULONG ssize = curCon->SendData.size() < BLOCKSIZE ? (ULONG)curCon->SendData.size() : BLOCKSIZE; DWORD ret = 0; size_t ret = 0; buffer buf(curCon->SendData.data(),ssize); ret = curCon->csock->sendData(buf,0); Loading Loading @@ -298,20 +295,23 @@ namespace netplus { }break; } } catch (NetException& e) { if (e.getErrorType() != NetException::Note) { std::cerr << e.what() << std::endl; if (e.getErrorType() == NetException::Note) { continue; } pOverlapped->hEvent=0; pClientContext->cltmtx.lock(); eargs->event->DisconnectEvent(*pClientContext->CurCon, tid, args); // Close the socket WSACloseEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); delete pClientContext->CurCon->csock; delete pClientContext; PostQueuedCompletionStatus(eargs->eviocp, 0, 0, pOverlapped); } } catch (...) { std::cerr << "Eventworker unknown error !" << std::endl; pOverlapped->hEvent = 0; pClientContext->cltmtx.lock(); eargs->event->DisconnectEvent(*pClientContext->CurCon, tid, args); // Close the socket WSACloseEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); delete pClientContext->CurCon->csock; delete pClientContext; PostQueuedCompletionStatus(eargs->eviocp, 0, 0, pOverlapped); } } // for } Loading Loading @@ -381,7 +381,7 @@ namespace netplus { throw exp; } if (SOCKET_ERROR == WSAEventSelect(_ServerSocket->fd(), g_hAcceptEvent, FD_ACCEPT | FD_READ | FD_WRITE)) { if (SOCKET_ERROR == WSAEventSelect(_ServerSocket->fd(), g_hAcceptEvent, FD_ACCEPT)) { NetException exp; exp[NetException::Error] << "Error occurred while WSAEventSelect()."; WSACloseEvent(g_hAcceptEvent); Loading
src/windows/tcp.cpp +6 −8 Changes for src/windows/tcp.cpp: 6 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ else buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwsend = 0; Loading @@ -212,13 +212,12 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ int etype = NetException::Error; if(rval == SOCKET_ERROR){ DWORD lerror=GetLastError(); int lerror= WSAGetLastError(); if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; } exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket throw exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)dwsend; } Loading @@ -234,7 +233,7 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ WSABUF buf; buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; Loading @@ -243,13 +242,12 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int etype = NetException::Error; if (rval == SOCKET_ERROR) { DWORD lerror = GetLastError(); int lerror = WSAGetLastError(); if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; } exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket throw exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)dwBytes; Loading
src/windows/udp.cpp +3 −3 Changes for src/windows/udp.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx,socket *csock) { ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -198,7 +198,7 @@ size_t netplus::udp::sendData(buffer &data, int flags) { else buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; DWORD dwFlags = 0; Loading Loading @@ -229,7 +229,7 @@ size_t netplus::udp::recvData(buffer &data, int flags) { WSABUF buf; buf.buf = data.data.buf; buf.len = data.size; buf.len = static_cast<ULONG>(data.size); DWORD dwBytes = 0; DWORD dwFlags = 0; Loading