Commit 1858ca68 authored by jan.koester's avatar jan.koester
Browse files

test

parent eed514a8
Loading
Loading
Loading
Loading
+12 −7
Changes for src/event/epoll.cpp: 12 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -350,12 +350,11 @@ namespace netplus {
                        }

                        // Step 3: Application data (handshake done)
                        // Process one TLS record per epoll event.  If more
                        // records are buffered, EpollArmGuard adds EPOLLOUT
                        // to re-trigger epoll_wait so we come back here.
                        // Drain all available TLS records to avoid stalling
                        // when multiple records arrive in a single TCP segment.
                        bool hasAppData = (events & EPOLLIN) ||
                                          c->csock->hasBufferedData();
                        if (hasAppData && c->csock->getHandshakeDone() && !needClose) {
                        while (hasAppData && c->csock->getHandshakeDone() && !needClose) {
                            buffer buf(BLOCKSIZE);
                            size_t rcv = 0;
                            bool wouldBlock = false;
@@ -377,7 +376,10 @@ namespace netplus {
                                c->RecvData.append(buf.data.buf, rcv);
                                evconnection->RequestEvent(*c, tid, args);
                            }
                            // wouldBlock with rcv==0: no complete record yet, just wait

                            // Continue only if there are more buffered records
                            if (wouldBlock || rcv == 0 || !c->csock->hasBufferedData())
                                break;
                        }

                        // Step 4: Flush and send
@@ -664,7 +666,7 @@ namespace netplus {

            epoll_event setevent{};
            setevent.events = EPOLLIN;
            setevent.data.fd = 0;
            setevent.data.fd = ss->fd();

            if (epoll_ctl(_pollFD, EPOLL_CTL_ADD, ss->fd(), &setevent) < 0) {
                NetException e;
@@ -703,7 +705,10 @@ namespace netplus {
        for (auto& t : threadpool)
            pthread_join(t, nullptr);

        close(_pollFD);
        // Close all epoll FDs (not just the last one)
        for (auto& kv : eargs.ssocket)
            close(kv.first);
        eargs.ssocket.clear();

        if (event::Restart) {
            event::Restart = false;