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

test

parent 119a1950
Loading
Loading
Loading
Loading
+16 −9
Changes for src/event/kqueue.cpp: 16 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -225,13 +225,18 @@ namespace netplus {
        };

        void ReadEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *rcon =  reinterpret_cast<con*>(_Events[pos].udata );
            buffer buf(BLOCKSIZE);
            con *rcon = nullptr;

            if (!rcon || !rcon->csock) {
                return;
            {
                std::lock_guard<std::mutex> global_lock(POLL_HANDLER_MUTEX);

                rcon = reinterpret_cast<con*>(_Events[pos].udata);

                if (!rcon || !rcon->csock) { return; }
            }

            buffer buf(BLOCKSIZE);

            std::lock_guard<std::mutex> lock_guard(rcon->event_mutex);

            if (!rcon || !rcon->csock) { return; }
@@ -265,15 +270,17 @@ namespace netplus {
        };

        void WriteEventHandler(int pos,const int tid,ULONG_PTR args) {
            con *wcon = reinterpret_cast<con*>(_Events[pos].udata);
            con *wcon = nullptr;

            if(!wcon ||  !wcon->csock){
                    return;
            }
            {
                std::lock_guard<std::mutex> global_lock(POLL_HANDLER_MUTEX);

            std::lock_guard<std::mutex> lock_guard(wcon->event_mutex);
                wcon = reinterpret_cast<con*>(_Events[pos].udata);

                if (!wcon || !wcon->csock) { return; }
            }

            std::lock_guard<std::mutex> lock_guard(wcon->event_mutex);

            try{
                evconnection->ResponseEvent(*wcon,tid,args);