Loading src/connection.cpp +32 −0 Changes for src/connection.cpp: 32 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -46,6 +46,12 @@ * Use it everyday with good health. */ netplus::condata<char>::condata() : vector(){ pos=0; limit=131072; } void netplus::condata<char>::resize(size_t size_c){ size_t rs = size(); Loading @@ -55,6 +61,11 @@ void netplus::condata<char>::resize(size_t size_c){ } void netplus::condata<char>::append(const char* data, size_t datalen){ if(this->size()+datalen > limit ){ NetException excep; excep[NetException::Note] << "condata: max size reached !"; throw excep; } std::copy(data,data+datalen,std::inserter<std::vector<char,condataAlloc<char>>>(*this,end())); } Loading @@ -75,6 +86,27 @@ size_t netplus::condata<char>::search(const char* word){ return std::string::npos; } void netplus::condata<char>::push_back(char a){ if(this->size()+sizeof(a) > limit ){ NetException excep; excep[NetException::Note] << "condata: max size reached !"; throw excep; } std::vector<char,condataAlloc<char>>push_back(a); } void netplus::condata<char>::setlimit(size_t size){ limit = size *1024; } size_t netplus::condata<char>::getlimit(){ return limit; } netplus::con::con(){ state=0; Loading src/connection.h +10 −0 Changes for src/connection.h: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,19 @@ namespace netplus { template <> class condata<char> : public std::vector<char,condataAlloc<char>>{ public: condata(); void resize(size_t size_c); void append(const char *data,size_t datalen); size_t search(const char *word); void push_back(char a); void setlimit(size_t size); size_t getlimit(); size_t pos; private: size_t limit; }; class con { Loading src/linux/event.cpp +9 −1 Changes for src/linux/event.cpp: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -249,9 +249,17 @@ namespace netplus { size_t ssize = BLOCKSIZE < wcon->SendData.size() ? BLOCKSIZE : wcon->SendData.size(); size_t sended = _ServerSocket->sendData(wcon->csock,wcon->SendData.data(),ssize); size_t sended; try{ sended = _ServerSocket->sendData(wcon->csock,wcon->SendData.data(),ssize); wcon->SendData.resize(sended); }catch(NetException &e){ if(e.getErrorType()!=NetException::Note){ throw e; } } wcon->lasteventime = time(nullptr); Loading Loading
src/connection.cpp +32 −0 Changes for src/connection.cpp: 32 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -46,6 +46,12 @@ * Use it everyday with good health. */ netplus::condata<char>::condata() : vector(){ pos=0; limit=131072; } void netplus::condata<char>::resize(size_t size_c){ size_t rs = size(); Loading @@ -55,6 +61,11 @@ void netplus::condata<char>::resize(size_t size_c){ } void netplus::condata<char>::append(const char* data, size_t datalen){ if(this->size()+datalen > limit ){ NetException excep; excep[NetException::Note] << "condata: max size reached !"; throw excep; } std::copy(data,data+datalen,std::inserter<std::vector<char,condataAlloc<char>>>(*this,end())); } Loading @@ -75,6 +86,27 @@ size_t netplus::condata<char>::search(const char* word){ return std::string::npos; } void netplus::condata<char>::push_back(char a){ if(this->size()+sizeof(a) > limit ){ NetException excep; excep[NetException::Note] << "condata: max size reached !"; throw excep; } std::vector<char,condataAlloc<char>>push_back(a); } void netplus::condata<char>::setlimit(size_t size){ limit = size *1024; } size_t netplus::condata<char>::getlimit(){ return limit; } netplus::con::con(){ state=0; Loading
src/connection.h +10 −0 Changes for src/connection.h: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,19 @@ namespace netplus { template <> class condata<char> : public std::vector<char,condataAlloc<char>>{ public: condata(); void resize(size_t size_c); void append(const char *data,size_t datalen); size_t search(const char *word); void push_back(char a); void setlimit(size_t size); size_t getlimit(); size_t pos; private: size_t limit; }; class con { Loading
src/linux/event.cpp +9 −1 Changes for src/linux/event.cpp: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -249,9 +249,17 @@ namespace netplus { size_t ssize = BLOCKSIZE < wcon->SendData.size() ? BLOCKSIZE : wcon->SendData.size(); size_t sended = _ServerSocket->sendData(wcon->csock,wcon->SendData.data(),ssize); size_t sended; try{ sended = _ServerSocket->sendData(wcon->csock,wcon->SendData.data(),ssize); wcon->SendData.resize(sended); }catch(NetException &e){ if(e.getErrorType()!=NetException::Note){ throw e; } } wcon->lasteventime = time(nullptr); Loading