Commit b4f3d6a9 authored by jan.koester's avatar jan.koester
Browse files

bugfixes

parent 373ef998
Loading
Loading
Loading
Loading
+2 −3
Changes for src/exception.cpp: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -47,11 +47,11 @@ netplus::NetException::NetException(const NetException &exp){
netplus::NetException::~NetException(){
}

int netplus::NetException::getErrorType(){
int netplus::NetException::getErrorType() const{
    return curCType; 
}

const char* netplus::NetException::what(){
const char* netplus::NetException::what() const{
    return msg.c_str();
}

@@ -71,7 +71,6 @@ netplus::NetException& netplus::NetException::operator<<(const char *src){
};

netplus::NetException& netplus::NetException::operator<<(int src){
    const std::lock_guard<std::mutex> lock(g_exception);
    char buffer[255];
    snprintf(buffer,255,"%d",src);
    msg.append(buffer);
+2 −2
Changes for src/exception.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -51,9 +51,9 @@ namespace netplus {
        NetException(const NetException &exp);
        virtual ~NetException();
        
        int getErrorType();
        int getErrorType() const;
        
        const char* what();
        const char* what() const;
        
        enum Type {Note,Warning,Error,Critical,Close};
        
+4 −4
Changes for src/windows/tcp.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -209,10 +209,9 @@ size_t netplus::tcp::sendData(buffer &data,int flags){

    NetException exception;

	int etype = NetException::Error;

    if(rval == SOCKET_ERROR){
        int lerror= WSAGetLastError();
        int etype = NetException::Error;
        if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) {
			etype = NetException::Note;
        }
@@ -239,10 +238,11 @@ size_t netplus::tcp::recvData(buffer &data,int flags){

    int rval=::WSARecv(_Socket, &buf, 1,&dwBytes,(LPDWORD) &flags, &_Overlapped, nullptr);

    int etype = NetException::Error;

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

        if (lerror == WSA_IO_PENDING || lerror == WSAEWOULDBLOCK) {
			etype = NetException::Note;
        }