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

optimize

parent cbae191b
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -156,11 +156,8 @@ void netplus::con::sending(bool state) {

netplus::con::condata *netplus::con::_resizeQueue(condata** firstdata, condata** lastdata,
                                                               unsigned long &qsize,unsigned long size){
    if (size == 0)
        return nullptr;

    NetException exception;
    if(!*firstdata || size > qsize){
    if(!*firstdata || size > qsize || qsize==0 || size==0){
        exception[NetException::Error] << "_resizeQueue wrong datasize or ConnectionData";
        throw exception;
    }
@@ -176,7 +173,7 @@ HAVEDATA:
    if((*firstdata)) {
            curlen += ((int)(*firstdata)->getDataLength() - size);

            if ( curlen <= 0 || size >= curlen) {
            if ( curlen <= 0 || size >= (unsigned long)curlen) {
                size -= (*firstdata)->getDataLength();
#ifdef DEBUG
                delsize += (*firstdata)->getDataLength();
@@ -187,8 +184,6 @@ HAVEDATA:
                    (*lastdata) = nullptr;
                delete* firstdata;
                (*firstdata) = newdat;
                if ((*firstdata) && size > 0)
                    goto HAVEDATA;
            }else{
                std::string buf = (*firstdata)->_Data.substr(size,curlen);
                (*firstdata)->_Data = buf;
@@ -206,7 +201,7 @@ HAVEDATA:
    //                              << " Calculated Blocksize: " << (presize-delsize)
    //                              << " Planned size: " << qsize
    //                              << std::endl;
    if((presize-delsize)!=qsize){
    if((unsigned long)(presize-delsize)!=qsize){
        exception[NetException::Critical] << "_resizeQueue: Calculated wrong size";
        throw exception;
    }
+2 −2
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ namespace netplus {
        }
        try {
            char buf[BLOCKSIZE];
            ssize_t rcvsize = _ServerSocket->recvData(rcon->csock, buf, BLOCKSIZE);
            size_t rcvsize = _ServerSocket->recvData(rcon->csock, buf, BLOCKSIZE);
            if(rcvsize==0)
                return;
            rcon->addRecvQueue(buf, rcvsize);
@@ -183,7 +183,7 @@ namespace netplus {
                exp[NetException::Note] << "WriteEvent: no data to send!" << pos;
                throw exp;
            }
            ssize_t sended = _ServerSocket->sendData(wcon->csock,
            size_t sended = _ServerSocket->sendData(wcon->csock,
                (void*)wcon->getSendData()->getData(),
                wcon->getSendData()->getDataLength(), 0);