Loading src/event/kqueue.cpp +10 −22 Changes for src/event/kqueue.cpp: 10 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -227,7 +227,9 @@ namespace netplus { return; } std::unique_lock<std::mutex> lock(rcon->event_mutex, std::defer_lock); std::lock_guard<std::mutex> lock(rcon->event_mutex); if (!rcon->csock) { return; } try{ buffer buf(BLOCKSIZE); Loading Loading @@ -269,6 +271,10 @@ namespace netplus { return; } std::lock_guard<std::mutex> lock(wcon->event_mutex); if (!wcon->csock) { return; } try{ _evtapi->ResponseEvent(*wcon,tid,args); Loading Loading @@ -314,35 +320,17 @@ namespace netplus { void CloseEventHandler(int pos, const int tid, ULONG_PTR args) { std::lock_guard<std::mutex> lock(_pollMutex); con *ccon = (con*)_Events[pos].udata; if (!ccon) { return; } if (ccon->csock) { try { struct kevent setevent { 0 }; EV_SET(&setevent, ccon->csock->fd(), 0, EV_DELETE, 0, 0, nullptr); std::lock_guard<std::mutex> lock(ccon->event_mutex); if (kevent(_pollFD, &setevent, 1, nullptr, 0, nullptr) < 0) { NetException e; e[NetException::Error] << "CloseEventHandler: cannot remove socket from kqueue list!"; std::cerr << e.what() << std::endl; } } catch (const std::exception& e) { std::cerr << "CloseEventHandler: Fatal error accessing socket FD: " << e.what() << std::endl; } catch (...) { std::cerr << "CloseEventHandler: Unknown fatal error during kevent setup." << std::endl; } } try { _evtapi->DisconnectEvent(*ccon, tid, args); } catch (...) { std::cerr << "Disconnect Event Fails!" << std::endl; if (ccon->csock) { setpollEvents(ccon, EVFILT_READ | EVFILT_WRITE, EV_DELETE); } delete ccon; Loading Loading
src/event/kqueue.cpp +10 −22 Changes for src/event/kqueue.cpp: 10 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -227,7 +227,9 @@ namespace netplus { return; } std::unique_lock<std::mutex> lock(rcon->event_mutex, std::defer_lock); std::lock_guard<std::mutex> lock(rcon->event_mutex); if (!rcon->csock) { return; } try{ buffer buf(BLOCKSIZE); Loading Loading @@ -269,6 +271,10 @@ namespace netplus { return; } std::lock_guard<std::mutex> lock(wcon->event_mutex); if (!wcon->csock) { return; } try{ _evtapi->ResponseEvent(*wcon,tid,args); Loading Loading @@ -314,35 +320,17 @@ namespace netplus { void CloseEventHandler(int pos, const int tid, ULONG_PTR args) { std::lock_guard<std::mutex> lock(_pollMutex); con *ccon = (con*)_Events[pos].udata; if (!ccon) { return; } if (ccon->csock) { try { struct kevent setevent { 0 }; EV_SET(&setevent, ccon->csock->fd(), 0, EV_DELETE, 0, 0, nullptr); std::lock_guard<std::mutex> lock(ccon->event_mutex); if (kevent(_pollFD, &setevent, 1, nullptr, 0, nullptr) < 0) { NetException e; e[NetException::Error] << "CloseEventHandler: cannot remove socket from kqueue list!"; std::cerr << e.what() << std::endl; } } catch (const std::exception& e) { std::cerr << "CloseEventHandler: Fatal error accessing socket FD: " << e.what() << std::endl; } catch (...) { std::cerr << "CloseEventHandler: Unknown fatal error during kevent setup." << std::endl; } } try { _evtapi->DisconnectEvent(*ccon, tid, args); } catch (...) { std::cerr << "Disconnect Event Fails!" << std::endl; if (ccon->csock) { setpollEvents(ccon, EVFILT_READ | EVFILT_WRITE, EV_DELETE); } delete ccon; Loading