Loading src/event/kqueue.cpp +9 −19 Changes for src/event/kqueue.cpp: 9 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ namespace netplus { ~poll() { int maxcon=_ServerSocket->getMaxconnections(); for (int i = 0; i < maxcon; ++i){ _evtapi->DestroyConnection((con*)_Events[i].udata); delete _evtapi->((con*)_Events[i].udata); } delete _Events; }; Loading Loading @@ -158,9 +158,9 @@ namespace netplus { void ConnectEventHandler(int pos,const int tid,ULONG_PTR args) { NetException exception; con *ccon; std::unique_ptr<con> ccon; _evtapi->CreateConnection(&ccon); _evtapi->CreateConnection(ccon); if(_ServerSocket->_Type==sockettype::TCP){ ccon->csock=new tcp(); Loading @@ -182,7 +182,9 @@ namespace netplus { struct kevent setevent { 0 }; EV_SET(&setevent, ccon->csock->fd(), EVFILT_READ, EV_ADD | EV_ONESHOT,0,0,ccon); con *ccon_ptr=ccon.release(); EV_SET(&setevent, ccon->csock->fd(), EVFILT_READ, EV_ADD | EV_ONESHOT,0,0,ccon_ptr); int estate = kevent(_pollFD, &setevent, 1, nullptr, 0, nullptr); Loading @@ -192,7 +194,7 @@ namespace netplus { exception[NetException::Error] << "ConnectEventHandler: can't add socket to kqueue: " << errstr; throw exception; } _evtapi->ConnectEvent(*ccon,tid,args); _evtapi->ConnectEvent(*ccon_ptr,tid,args); }; Loading Loading @@ -395,20 +397,8 @@ namespace netplus { //dummy }; void eventapi::CreateConnection(con **curcon){ //dummy }; void eventapi::DestroyConnection(con *curcon){ //dummy }; void event::CreateConnection(con **curcon){ *curcon=new con(this); }; void event::DestroyConnection(con *curcon){ delete curcon; void event::CreateConnection(std::unique_ptr<con> &curcon){ curcon=std::unique_ptr<con>(new con(this)); }; event::event(socket* serversocket,int timeout) { Loading Loading
src/event/kqueue.cpp +9 −19 Changes for src/event/kqueue.cpp: 9 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -105,7 +105,7 @@ namespace netplus { ~poll() { int maxcon=_ServerSocket->getMaxconnections(); for (int i = 0; i < maxcon; ++i){ _evtapi->DestroyConnection((con*)_Events[i].udata); delete _evtapi->((con*)_Events[i].udata); } delete _Events; }; Loading Loading @@ -158,9 +158,9 @@ namespace netplus { void ConnectEventHandler(int pos,const int tid,ULONG_PTR args) { NetException exception; con *ccon; std::unique_ptr<con> ccon; _evtapi->CreateConnection(&ccon); _evtapi->CreateConnection(ccon); if(_ServerSocket->_Type==sockettype::TCP){ ccon->csock=new tcp(); Loading @@ -182,7 +182,9 @@ namespace netplus { struct kevent setevent { 0 }; EV_SET(&setevent, ccon->csock->fd(), EVFILT_READ, EV_ADD | EV_ONESHOT,0,0,ccon); con *ccon_ptr=ccon.release(); EV_SET(&setevent, ccon->csock->fd(), EVFILT_READ, EV_ADD | EV_ONESHOT,0,0,ccon_ptr); int estate = kevent(_pollFD, &setevent, 1, nullptr, 0, nullptr); Loading @@ -192,7 +194,7 @@ namespace netplus { exception[NetException::Error] << "ConnectEventHandler: can't add socket to kqueue: " << errstr; throw exception; } _evtapi->ConnectEvent(*ccon,tid,args); _evtapi->ConnectEvent(*ccon_ptr,tid,args); }; Loading Loading @@ -395,20 +397,8 @@ namespace netplus { //dummy }; void eventapi::CreateConnection(con **curcon){ //dummy }; void eventapi::DestroyConnection(con *curcon){ //dummy }; void event::CreateConnection(con **curcon){ *curcon=new con(this); }; void event::DestroyConnection(con *curcon){ delete curcon; void event::CreateConnection(std::unique_ptr<con> &curcon){ curcon=std::unique_ptr<con>(new con(this)); }; event::event(socket* serversocket,int timeout) { Loading