Commit f3a61f1e authored by Jan Koester's avatar Jan Koester
Browse files

test

parent 316b36d3
Loading
Loading
Loading
Loading
+11 −1
Changes for src/connection.h: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <atomic>
#include <limits>
#include <type_traits>
#include <ctime>

#include <cstddef>

@@ -214,7 +215,16 @@ namespace netplus {

            std::recursive_mutex event_mutex;

             time_t lasteventime;
            // Written under event_mutex/the per-socket lock by whichever
            // backend's I/O path touched this connection last (e.g.
            // epoll.cpp:343 etc.), but read by reapIdleConnections() under a
            // *different* lock (POLL_HANDLER_MUTEX) -- was a plain time_t,
            // making that a genuine unsynchronized concurrent read/write.
            // time_t fits std::atomic lock-free on every supported platform;
            // also give it a real initial value instead of leaving it
            // uninitialized (an idle sweep running before this connection's
            // first real I/O would otherwise compare against garbage).
            std::atomic<time_t> lasteventime{time(nullptr)};

            // Epoll (or equivalent) fd this connection's primary socket is
            // registered under. Set once at accept time (ConnectEventHandler).
+3 −3
Changes for src/eventapi.h: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -99,9 +99,9 @@ namespace netplus {
            // the life of the process -- there was previously no time-based reclamation
            // anywhere in this stack, only reactive close-on-peer-error/EOF. 0 = disabled
            // (default): matches every accepted connection's previous behavior exactly, so
            // existing deployments are unaffected until they opt in. Implemented on the epoll
            // and kqueue backends only, same documented-no-op precedent as
            // requestWritablePoll()/detachConnection() for poll.cpp/iocp.cpp (connection.h).
            // existing deployments are unaffected until they opt in. Implemented on the epoll,
            // kqueue, and iocp backends; poll.cpp is the one true no-op here, same documented
            // precedent as requestWritablePoll()/detachConnection() (connection.h).
            event(std::vector<netplus::socket*> serversockets, int timeout=1000,
                  int idleTimeoutSeconds=0);