Commit 7a700a24 authored by jan.koester's avatar jan.koester
Browse files

con added ext pointer

parent 3291e706
Loading
Loading
Loading
Loading
+4 −0
Changes for src/connection.h: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -179,6 +179,10 @@ namespace netplus {

            int DebugId=0;

            // Application-defined extension data.
            // Allows frameworks to attach per-connection state without external maps.
            std::unique_ptr<void, void(*)(void*)> extension{nullptr, +[](void*){}};

            std::mutex event_mutex;

             time_t lasteventime;
+4 −18
Changes for src/event/epoll.cpp: 4 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -424,12 +424,10 @@ namespace netplus {
                                break;
                        }

                        // Step 4: Flush, send, and handle keep-alive pipelining.
                        // Wrapped in a loop so that after ResponseEvent resets
                        // the request state, any already-buffered next request
                        // in RecvData gets dispatched and sent immediately
                        // instead of stalling until the next EPOLLIN event.
                        for (;;) {
                        // Step 4: Flush and send
                        // Always attempt to send if there is data queued
                        // (browsers require the server's HTTP/2 SETTINGS before
                        //  sending their request, so we must not wait for EPOLLOUT)
                        if ((c->SendData.pos < c->SendData.size() || c->csock->hasPendingWrite()) && !needClose) {
                            if (c->csock->hasPendingWrite()) {
                                try {
@@ -496,18 +494,6 @@ namespace netplus {
                                evconnection->ResponseEvent(*c, tid, args);
                            }
                        }

                        // Keep-alive pipelining: if ResponseEvent cleared the
                        // request state and RecvData still has bytes from the
                        // next request, dispatch it now and loop back to send.
                        if (!needClose && !c->RecvData.empty() &&
                            c->SendData.pos >= c->SendData.size()) {
                            evconnection->RequestEvent(*c, tid, args);
                            if (c->SendData.pos < c->SendData.size())
                                continue;   // new response queued → send it
                        }
                        break;  // nothing more to pipeline
                        } // end keep-alive loop
                    }

                } catch (NetException& e) {