Loading src/connection.cpp +0 −7 Changes for src/connection.cpp: 0 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -150,14 +150,8 @@ size_t netplus::con::getRecvLength(){ void netplus::con::sending(bool state) { _eventapi->sendReady(this,state); _sending.store(state); } bool netplus::con::issending() { return _sending.load(); } netplus::con::condata *netplus::con::_resizeQueue(condata** firstdata, condata** lastdata,size_t &qsize,size_t size){ NetException exception; if (!*firstdata || size > qsize) { Loading Loading @@ -269,7 +263,6 @@ netplus::con::con(){ _SendDataFirst=nullptr; _SendDataLast=nullptr; _SendDataLength=0; _sending=false; } netplus::con::con(eventapi *eapi) : con(){ Loading src/connection.h +0 −4 Changes for src/connection.h: 0 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -82,7 +82,6 @@ namespace netplus { /*set sending state*/ void sending(bool state); bool issending(); std::atomic<bool> closecon; protected: Loading @@ -104,9 +103,6 @@ namespace netplus { condata *_SendDataLast; eventapi *_eventapi; /*if pollout*/ std::atomic<bool> _sending; friend class poll; }; }; src/eventapi.h +2 −1 Changes for src/eventapi.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -50,13 +50,14 @@ namespace netplus { /*Connection Ready to send Data * DANGEROUS to burnout your cpu *only use this if know what you do!*/ void sendReady(con *curcon,bool ready); virtual void sendReady(con *curcon,bool ready)=0; }; class event : public eventapi{ public: event(socket *serversocket); void runEventloop(); void sendReady(con* curcon, bool ready); static void *WorkerThread(void *wrkevent); virtual ~event(); Loading src/linux/event.cpp +11 −21 Changes for src/linux/event.cpp: 11 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -147,7 +147,7 @@ namespace netplus { if(!pcon) return EventHandlerStatus::EVCON; if(pcon->issending()) if( _Events[pos].events & EPOLLOUT ) return EventHandlerStatus::EVOUT; return EventHandlerStatus::EVIN; Loading Loading @@ -238,12 +238,6 @@ namespace netplus { rcvsize=_ServerSocket->recvData(rcon->csock, buf, BLOCKSIZE); if(rcvsize==0){ NetException exp; exp[NetException::Note] << "ReadEvent: no data recived!"; throw exp; } rcon->addRecvQueue(buf, rcvsize); _evtapi->RequestEvent(rcon); }; Loading @@ -263,11 +257,6 @@ namespace netplus { (void*)wcon->getSendFirst()->getData(), wcon->getSendFirst()->getDataLength()); if(sended==0){ NetException exp; exp[NetException::Note] << "WriteEvent: cannot send data!"; throw exp; } _evtapi->ResponseEvent(wcon); wcon->resizeSendQueue(sended); }; Loading @@ -282,6 +271,7 @@ namespace netplus { }; void setpollEvents(con* curcon, int events) { std::cout << "test" << std::endl; NetException except; struct poll_event setevent { 0 }; setevent.events = events; Loading @@ -293,15 +283,6 @@ namespace netplus { } }; /*Connection Ready to send Data*/ void sendReady(con* curcon, bool ready) { if (ready) { setpollEvents(curcon, EPOLLIN | EPOLLOUT); } else { setpollEvents(curcon, EPOLLIN); } }; private: int _pollFD; struct poll_event *_Events; Loading Loading @@ -422,6 +403,15 @@ namespace netplus { event::~event() { } /*Connection Ready to send Data*/ void event::sendReady(con* curcon, bool ready) { if (ready) { _Poll->setpollEvents(curcon, EPOLLIN | EPOLLOUT); } else { _Poll->setpollEvents(curcon, EPOLLIN); } }; void event::runEventloop() { size_t thrs = sysconf(_SC_NPROCESSORS_ONLN); signal(SIGPIPE, SIG_IGN); Loading Loading
src/connection.cpp +0 −7 Changes for src/connection.cpp: 0 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -150,14 +150,8 @@ size_t netplus::con::getRecvLength(){ void netplus::con::sending(bool state) { _eventapi->sendReady(this,state); _sending.store(state); } bool netplus::con::issending() { return _sending.load(); } netplus::con::condata *netplus::con::_resizeQueue(condata** firstdata, condata** lastdata,size_t &qsize,size_t size){ NetException exception; if (!*firstdata || size > qsize) { Loading Loading @@ -269,7 +263,6 @@ netplus::con::con(){ _SendDataFirst=nullptr; _SendDataLast=nullptr; _SendDataLength=0; _sending=false; } netplus::con::con(eventapi *eapi) : con(){ Loading
src/connection.h +0 −4 Changes for src/connection.h: 0 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -82,7 +82,6 @@ namespace netplus { /*set sending state*/ void sending(bool state); bool issending(); std::atomic<bool> closecon; protected: Loading @@ -104,9 +103,6 @@ namespace netplus { condata *_SendDataLast; eventapi *_eventapi; /*if pollout*/ std::atomic<bool> _sending; friend class poll; }; };
src/eventapi.h +2 −1 Changes for src/eventapi.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -50,13 +50,14 @@ namespace netplus { /*Connection Ready to send Data * DANGEROUS to burnout your cpu *only use this if know what you do!*/ void sendReady(con *curcon,bool ready); virtual void sendReady(con *curcon,bool ready)=0; }; class event : public eventapi{ public: event(socket *serversocket); void runEventloop(); void sendReady(con* curcon, bool ready); static void *WorkerThread(void *wrkevent); virtual ~event(); Loading
src/linux/event.cpp +11 −21 Changes for src/linux/event.cpp: 11 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -147,7 +147,7 @@ namespace netplus { if(!pcon) return EventHandlerStatus::EVCON; if(pcon->issending()) if( _Events[pos].events & EPOLLOUT ) return EventHandlerStatus::EVOUT; return EventHandlerStatus::EVIN; Loading Loading @@ -238,12 +238,6 @@ namespace netplus { rcvsize=_ServerSocket->recvData(rcon->csock, buf, BLOCKSIZE); if(rcvsize==0){ NetException exp; exp[NetException::Note] << "ReadEvent: no data recived!"; throw exp; } rcon->addRecvQueue(buf, rcvsize); _evtapi->RequestEvent(rcon); }; Loading @@ -263,11 +257,6 @@ namespace netplus { (void*)wcon->getSendFirst()->getData(), wcon->getSendFirst()->getDataLength()); if(sended==0){ NetException exp; exp[NetException::Note] << "WriteEvent: cannot send data!"; throw exp; } _evtapi->ResponseEvent(wcon); wcon->resizeSendQueue(sended); }; Loading @@ -282,6 +271,7 @@ namespace netplus { }; void setpollEvents(con* curcon, int events) { std::cout << "test" << std::endl; NetException except; struct poll_event setevent { 0 }; setevent.events = events; Loading @@ -293,15 +283,6 @@ namespace netplus { } }; /*Connection Ready to send Data*/ void sendReady(con* curcon, bool ready) { if (ready) { setpollEvents(curcon, EPOLLIN | EPOLLOUT); } else { setpollEvents(curcon, EPOLLIN); } }; private: int _pollFD; struct poll_event *_Events; Loading Loading @@ -422,6 +403,15 @@ namespace netplus { event::~event() { } /*Connection Ready to send Data*/ void event::sendReady(con* curcon, bool ready) { if (ready) { _Poll->setpollEvents(curcon, EPOLLIN | EPOLLOUT); } else { _Poll->setpollEvents(curcon, EPOLLIN); } }; void event::runEventloop() { size_t thrs = sysconf(_SC_NPROCESSORS_ONLN); signal(SIGPIPE, SIG_IGN); Loading