On Fri, 17 Oct 2025 12:31:29 +0200
Laurent Vivier
Extract the epoll event processing logic from main() into a separate passt_worker() function. This refactoring prepares the code for future threading support where passt_worker() will be called as a worker thread callback.
The new function handles: - Processing epoll events and dispatching to protocol handlers - Event statistics tracking and printing - Post-handler periodic tasks (timers, deferred work) - Migration handling
No functional changes, purely a code restructuring.
Signed-off-by: Laurent Vivier
--- passt.c | 160 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 88 insertions(+), 72 deletions(-) diff --git a/passt.c b/passt.c index 37f2c897be84..5bfa4c6353d9 100644 --- a/passt.c +++ b/passt.c @@ -229,6 +229,92 @@ static void print_stats(const struct ctx *c, const struct passt_stats *stats, lines_printed++; }
+/** + * passt_worker() - Process epoll events and handle protocol operations + * @opaque: Pointer to execution context (struct ctx) + * @nfds: Number of file descriptors ready (epoll_wait return value) + * @events: epoll_event array of ready file descriptors + */ +static void passt_worker(void *opaque, int nfds, struct epoll_event *events)
Nit: excess whitespace. The rest of the series looks good to me, all tests pass as well. -- Stefano