Loading src/event/iocp.cpp +1 Changes for src/event/iocp.cpp: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ 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(); Loading src/exception.cpp +4 −4 Changes for src/exception.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -51,11 +51,11 @@ int netplus::NetException::getErrorType() const{ return curCType; } const char* netplus::NetException::what() const{ return msg.c_str(); const std::string &netplus::NetException::what() const{ return msg; } netplus::NetException& netplus::NetException::append(const char *src){ netplus::NetException& netplus::NetException::append(const std::string& src){ const std::lock_guard<std::mutex> lock(g_exception); msg.append(src); return *this; Loading @@ -66,7 +66,7 @@ netplus::NetException& netplus::NetException::operator[](int errtype){ return *this; } netplus::NetException& netplus::NetException::operator<<(const char *src){ netplus::NetException& netplus::NetException::operator<<(const std::string& src){ return append(src); }; Loading src/exception.h +3 −3 Changes for src/exception.h: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -53,13 +53,13 @@ namespace netplus { int getErrorType() const; const char* what() const; const std::string &what() const; enum Type {Note,Warning,Error,Critical,Close}; NetException& append(const char *src); NetException& append(const std::string& src); NetException& operator[](int errtype); NetException& operator<<(const char *src); NetException& operator<<(const std::string& src); NetException& operator<<(int src); private: int curCType; Loading src/windows/tcp.cpp +23 −15 Changes for src/windows/tcp.cpp: 23 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -205,18 +205,23 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ DWORD dwsend = 0; SOCKET rval=::WSASend(_Socket,&buf,1,&dwsend,flags,&_Overlapped,nullptr); int rval=::WSASend(_Socket,&buf,1,&dwsend,flags,&_Overlapped,nullptr); NetException exception; if(rval == SOCKET_ERROR){ int lerror= WSAGetLastError(); int etype = NetException::Error; if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; switch(WSAGetLastError()){ case WSAEWOULDBLOCK: throw exception[NetException::Note] << "Socket senddata failed WSAWOULDBLOCK on Socket: " << (int)_Socket; case WSA_IO_PENDING: throw exception[NetException::Note] << "Socket senddata failed WSA_IO_PENDING on Socket: " << (int)_Socket; case WSAENOTCONN: throw exception[NetException::Error] << "Socket senddata failed WSAENOTCONN on Socket: " << (int)_Socket; case WSAECONNRESET: throw exception[NetException::Error] << "Socket senddata failed WSAECONNRESET on Socket: " << (int)_Socket; default: throw exception[NetException::Error] << "Socket senddata failed some Error on Socket: " << (int)_Socket; } throw exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; } return (size_t)dwsend; } Loading @@ -239,15 +244,18 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int rval=::WSARecv(_Socket, &buf, 1,&dwBytes,(LPDWORD) &flags, &_Overlapped, nullptr); if (rval == SOCKET_ERROR) { int lerror = WSAGetLastError(); int etype = NetException::Error; if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; switch (WSAGetLastError()) { case WSAEWOULDBLOCK: throw exception[NetException::Note] << "Socket senddata failed WSAWOULDBLOCK on Socket: " << (int)_Socket; case WSA_IO_PENDING: throw exception[NetException::Note] << "Socket senddata failed WSA_IO_PENDING on Socket: " << (int)_Socket; case WSAENOTCONN: throw exception[NetException::Error] << "Socket senddata failed WSAENOTCONN on Socket: " << (int)_Socket; case WSAECONNRESET: throw exception[NetException::Error] << "Socket senddata failed WSAECONNRESET on Socket: " << (int)_Socket; default: throw exception[NetException::Error] << "Socket senddata failed some Error on Socket: " << (int)_Socket; } throw exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; } return (size_t)dwBytes; Loading Loading
src/event/iocp.cpp +1 Changes for src/event/iocp.cpp: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ 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(); Loading
src/exception.cpp +4 −4 Changes for src/exception.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -51,11 +51,11 @@ int netplus::NetException::getErrorType() const{ return curCType; } const char* netplus::NetException::what() const{ return msg.c_str(); const std::string &netplus::NetException::what() const{ return msg; } netplus::NetException& netplus::NetException::append(const char *src){ netplus::NetException& netplus::NetException::append(const std::string& src){ const std::lock_guard<std::mutex> lock(g_exception); msg.append(src); return *this; Loading @@ -66,7 +66,7 @@ netplus::NetException& netplus::NetException::operator[](int errtype){ return *this; } netplus::NetException& netplus::NetException::operator<<(const char *src){ netplus::NetException& netplus::NetException::operator<<(const std::string& src){ return append(src); }; Loading
src/exception.h +3 −3 Changes for src/exception.h: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -53,13 +53,13 @@ namespace netplus { int getErrorType() const; const char* what() const; const std::string &what() const; enum Type {Note,Warning,Error,Critical,Close}; NetException& append(const char *src); NetException& append(const std::string& src); NetException& operator[](int errtype); NetException& operator<<(const char *src); NetException& operator<<(const std::string& src); NetException& operator<<(int src); private: int curCType; Loading
src/windows/tcp.cpp +23 −15 Changes for src/windows/tcp.cpp: 23 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -205,18 +205,23 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ DWORD dwsend = 0; SOCKET rval=::WSASend(_Socket,&buf,1,&dwsend,flags,&_Overlapped,nullptr); int rval=::WSASend(_Socket,&buf,1,&dwsend,flags,&_Overlapped,nullptr); NetException exception; if(rval == SOCKET_ERROR){ int lerror= WSAGetLastError(); int etype = NetException::Error; if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; switch(WSAGetLastError()){ case WSAEWOULDBLOCK: throw exception[NetException::Note] << "Socket senddata failed WSAWOULDBLOCK on Socket: " << (int)_Socket; case WSA_IO_PENDING: throw exception[NetException::Note] << "Socket senddata failed WSA_IO_PENDING on Socket: " << (int)_Socket; case WSAENOTCONN: throw exception[NetException::Error] << "Socket senddata failed WSAENOTCONN on Socket: " << (int)_Socket; case WSAECONNRESET: throw exception[NetException::Error] << "Socket senddata failed WSAECONNRESET on Socket: " << (int)_Socket; default: throw exception[NetException::Error] << "Socket senddata failed some Error on Socket: " << (int)_Socket; } throw exception[etype] << "Socket senddata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; } return (size_t)dwsend; } Loading @@ -239,15 +244,18 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int rval=::WSARecv(_Socket, &buf, 1,&dwBytes,(LPDWORD) &flags, &_Overlapped, nullptr); if (rval == SOCKET_ERROR) { int lerror = WSAGetLastError(); int etype = NetException::Error; if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) { etype = NetException::Note; switch (WSAGetLastError()) { case WSAEWOULDBLOCK: throw exception[NetException::Note] << "Socket senddata failed WSAWOULDBLOCK on Socket: " << (int)_Socket; case WSA_IO_PENDING: throw exception[NetException::Note] << "Socket senddata failed WSA_IO_PENDING on Socket: " << (int)_Socket; case WSAENOTCONN: throw exception[NetException::Error] << "Socket senddata failed WSAENOTCONN on Socket: " << (int)_Socket; case WSAECONNRESET: throw exception[NetException::Error] << "Socket senddata failed WSAECONNRESET on Socket: " << (int)_Socket; default: throw exception[NetException::Error] << "Socket senddata failed some Error on Socket: " << (int)_Socket; } throw exception[etype] << "Socket Recv failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; } return (size_t)dwBytes; Loading