Loading src/event/epoll.cpp +16 −15 Original line number Diff line number Diff line Loading @@ -155,10 +155,7 @@ namespace netplus { void ConnectEventHandler(int pos,const int tid,void *args) { NetException exception; con *ccon=(con*)_Events[pos].data.ptr; if(ccon) CloseEventHandler(pos,tid,args); con *ccon; _evtapi->CreateConnetion(&ccon); Loading Loading @@ -190,6 +187,9 @@ namespace netplus { if ( estate < 0 ) { char errstr[255]; strerror_r_netplus(errno,errstr,255); if(errno==EAGAIN) exception[NetException::Note] << "ConnectEventHandler: can't add socket to epoll: " << errstr; else exception[NetException::Error] << "ConnectEventHandler: can't add socket to epoll: " << errstr; throw exception; } Loading @@ -199,7 +199,7 @@ namespace netplus { void ReadEventHandler(int pos,const int tid,void *args) { con *rcon = (con*)_Events[pos].data.ptr; std::shared_ptr<char[BLOCKSIZE]> buf( new char[BLOCKSIZE], []( char *p ){ delete [] p; }); std::shared_ptr<char[]> buf( new char[BLOCKSIZE], []( char *p ){ delete [] p; }); try{ size_t rcvsize = _ServerSocket->recvData(rcon->csock, buf.get(), BLOCKSIZE); Loading Loading @@ -271,7 +271,7 @@ namespace netplus { void CloseEventHandler(int pos,const int tid,void *args) { con *ccon = (con*)_Events[pos].data.ptr; try{ if(_pollFD!=pos){ if(epoll_ctl(_pollFD, EPOLL_CTL_DEL,ccon->csock->fd(), nullptr)<0){ NetException except; char errstr[255]; Loading @@ -279,9 +279,10 @@ namespace netplus { except[NetException::Error] << "CloseEventHandler: can't close socket to epoll: " << errstr; throw except; } delete ccon->csock; _evtapi->DisconnectEvent(ccon,tid,args); } delete ccon->csock; _evtapi->deleteConnetion(ccon); Loading Loading
src/event/epoll.cpp +16 −15 Original line number Diff line number Diff line Loading @@ -155,10 +155,7 @@ namespace netplus { void ConnectEventHandler(int pos,const int tid,void *args) { NetException exception; con *ccon=(con*)_Events[pos].data.ptr; if(ccon) CloseEventHandler(pos,tid,args); con *ccon; _evtapi->CreateConnetion(&ccon); Loading Loading @@ -190,6 +187,9 @@ namespace netplus { if ( estate < 0 ) { char errstr[255]; strerror_r_netplus(errno,errstr,255); if(errno==EAGAIN) exception[NetException::Note] << "ConnectEventHandler: can't add socket to epoll: " << errstr; else exception[NetException::Error] << "ConnectEventHandler: can't add socket to epoll: " << errstr; throw exception; } Loading @@ -199,7 +199,7 @@ namespace netplus { void ReadEventHandler(int pos,const int tid,void *args) { con *rcon = (con*)_Events[pos].data.ptr; std::shared_ptr<char[BLOCKSIZE]> buf( new char[BLOCKSIZE], []( char *p ){ delete [] p; }); std::shared_ptr<char[]> buf( new char[BLOCKSIZE], []( char *p ){ delete [] p; }); try{ size_t rcvsize = _ServerSocket->recvData(rcon->csock, buf.get(), BLOCKSIZE); Loading Loading @@ -271,7 +271,7 @@ namespace netplus { void CloseEventHandler(int pos,const int tid,void *args) { con *ccon = (con*)_Events[pos].data.ptr; try{ if(_pollFD!=pos){ if(epoll_ctl(_pollFD, EPOLL_CTL_DEL,ccon->csock->fd(), nullptr)<0){ NetException except; char errstr[255]; Loading @@ -279,9 +279,10 @@ namespace netplus { except[NetException::Error] << "CloseEventHandler: can't close socket to epoll: " << errstr; throw except; } delete ccon->csock; _evtapi->DisconnectEvent(ccon,tid,args); } delete ccon->csock; _evtapi->deleteConnetion(ccon); Loading