Commit d05ef3e3 authored by jan.koester's avatar jan.koester
Browse files

test

parent 810523f2
Loading
Loading
Loading
Loading
+12 −10
Changes for src/event/kqueue.cpp: 12 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -308,14 +308,11 @@ namespace netplus {
        void CloseEventHandler(int pos, const int tid, ULONG_PTR args) {
            std::lock_guard<std::mutex> lock(_pollMutex);

            if (!_Events[pos].udata) {
                return;
            }

            con *ccon = (con*)_Events[pos].udata;

            if(!ccon)
            if (!ccon) {
                return;
            }

            try {
                struct kevent setevent { 0 };
@@ -326,18 +323,23 @@ namespace netplus {
                    NetException except;
                    char errstr[255];
                    strerror_r_netplus(errno, errstr, 255);
                    except[NetException::Error] << "CloseEventHandler: can't close socket to kqueue: " << errstr;
                    throw except;
                    except[NetException::Error] << "CloseEventHandler: kqueue EV_DELETE failed: " << errstr;
                    std::cerr << except.what() << std::endl; // Log the failure
                }

                _evtapi->DisconnectEvent(*ccon, tid, args);

                delete ccon;

            } catch (NetException &e) {
                throw e;
                std::cerr << "CloseEventHandler Disconnect Error: " << e.what() << std::endl;
            }

            try {
                delete ccon;
            } catch (const std::exception& e) {
                std::cerr << "CRITICAL: Exception during ccon deletion: " << e.what() << std::endl;
            } catch (...) {
                std::cerr << "CRITICAL: Unknown exception during ccon deletion." << std::endl;
            }
        };

    private: