Commit 5beca879 authored by jan.koester's avatar jan.koester
Browse files

fixed

parent 3b833167
Loading
Loading
Loading
Loading
+4 −8
Changes for src/event/epoll.cpp: 4 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -581,7 +581,8 @@ namespace netplus {
        void CloseEventHandler(int fd, const int tid, ULONG_PTR args) override {
            std::shared_ptr<con> ccon;

            // take out of map first
            epoll_ctl(_pollFD, EPOLL_CTL_DEL, fd, nullptr);

            {
                std::unique_lock<std::shared_mutex> lock(POLL_HANDLER_MUTEX);
                auto it = CONNECTIONS.find(fd);
@@ -593,21 +594,16 @@ namespace netplus {

            if (!ccon) return;

            // now lock per connection
            // 3. Lock per connection and close the socket[cite: 1]
            {
                std::lock_guard<std::recursive_mutex> lk(ccon->event_mutex);

                // remove from epoll
                epoll_ctl(_pollFD, EPOLL_CTL_DEL, fd, nullptr);

                // close socket
                safeCloseSocket(ccon);
            }

            try {
                evconnection->DisconnectEvent(*ccon, tid, args);
            } catch (...) {
                // ignore user callback failures
                // ignore user callback failures[cite: 1]
            }
        }