summaryrefslogtreecommitdiff
path: root/opentracker.c
AgeCommit message (Collapse)Author
8 daysMove the build sources into src/Dirk Engling
8 daysSweep the obsolete CVS Id keyword out of the treeDirk Engling
10 daysGeneralize the worker setup/runloop/teardown logic by adding a smol ot_worker helperDirk Engling
10 daysRefactor ot_workqueue out of ot_mutex, no behaviour changeDirk Engling
10 daysMake the mainloop behave like every worker by claiming and releasing a socket being worked onDirk Engling
10 daysMake tcp worker multithreaded, tooDirk Engling
This shamelessly steals the model established in the UDP workers, i.e. if the kernel is able to bind multiple listening sockets to the same endpoint, we will share them across threads. If it can't, all threads will accept on the same socket. The fast path handles most of the connections, only the rare case of no data yet on the socket is offloaded to the slow path (which used to be the mainloop) for completion. This scales nicely, as the higher the load is, the higher chances are that an accept happens only after the network roundtrip to the peer completes, leading to more connections that already have data waiting for us. We also consolidate the workstruct init and deinit code, preparation for later unifying all thread state structs for all protocols (mca, udc and tcp). The config file gains a per tcp connection worker count and some docs explaining what this knob buys and costs, nudging the user to either keep it 0 or dial it up to at least 2.
11 daysRefactor all tcp specific code into the ot_tcp module to prepare for multiple concurrent workersDirk Engling
11 daysIntroduce a fast path assuming that a tcp connection's payload already has arrived at accept timeDirk Engling
11 daysDefer accepts until some data actually is thereDirk Engling
11 daysEnforce the invariant that each socket is only ever expected to be read from or written to, never bothDirk Engling
11 daysReduce syscalls and add helper to count themDirk Engling
12 daysConsolidate all tcp/http tear down into a single http_close function to prevent a rare UAF for expiring connectionsDirk Engling
13 daysRevert last wake-up experiment. Having each udp worker wake up once a second to check if the tracker stops is wastefulDirk Engling
13 daysWith more workers blockingly waiting on udp sockets, we need to keep track of all sockets to shut them down on exitDirk Engling
13 daysPerformance improvement, where it works: Let different udp worker threads have their own socketDirk Engling
14 daysThe main event loop(s) now also catch an EINTR and return instead of blockingDirk Engling
14 daysPlug in the new per-thread stats counter, also make sure that the ot_clean sleep does not stall tracker exitDirk Engling
14 daysTurn malloc+memset into callocDirk Engling
14 daysForgot some g_now_seconds occurencesDirk Engling
14 daysAll OSes now do have a cheap monotonic clock, so no caching thread is needed. Also add some relative time helpersDirk Engling
2026-10-27Revive http keep alive to save tcp connection setup costsDirk Engling
2026-10-26Replace libowfat's event waiter with our own abstractionDirk Engling
It's with a heavy heart that I remove libowfat as my event library from opentracker. libowfat is what taught opentracker to walk and then fly. The tracker was literally standing on the shoulder of giants when I started writing it in 2006. For its time, the event abstraction was unparalleled and it has held up for many years, and it served the bittorrent community greatly. https://erdgeist.org/gitweb/opentracker/commit/?id=ad472597c569568bad0526d116b601dfcb36638c Unfortunately, it is very likely that libowfat will not be maintained anymore for the foreseeable future, it is already not easy to get its source from upstream and opentracker started receiving bug reports that I can not reasonably answer or patch. Before the project gets more dependent on the limitations of libowfat's current state, I need to teach opentracker to stand on its own feet and fly by itself. I've learned a great deal in the process and have even more respect now for what libowfat pioneered. The path for opentracker is cleared now. Ground work has already been laid in the migration process to support multi threaded http processing while keeping the aggressive reduction of syscalls alive that made the libowfat+opentracker combo so scalable. Here be some dragons, though: Even though there is a unit test suite now, the event loop's rewrite has not been battle tested yet. So you might want to hold up for a bit before jumping on the solo band wagon. What awaits at the end will be a long overdue v1.0, which will be named in honour of Felix.
2026-10-26Third run of making variable and function names more readable, integer scans and ip parsersDirk Engling
2026-10-26Second run of making variable and function names more readable, urlencoder now matches overall naming schemeDirk Engling
2026-10-26Use new fdstate subsystem to store per fd cookie and timeoutDirk Engling
2026-10-25Factor out the timeout setter, will probably go later once we do the io loop ourselfDirk Engling
2026-10-25Replace libowfat's iobatch with our own smaller (and probably only temporary) ot_batchDirk Engling
2026-10-25Be stricter about const char*, Wwrite-strings will warn in the future and we don't want to try to overwrite string literalsDirk Engling
2026-10-25white space fixesDirk Engling
2026-10-25Split options parsing and config code from opentracker.c, it has grown humongousDirk Engling
2026-10-25Fix build. Last commit was too huge ;)Dirk Engling
2026-10-25Decouple config parsing from binding and worker spawningDirk Engling
* Options are parsed now into a listener description list before binding them at once and starting the workers later * UDP workers can now be configured per connection * socket reuse is now done more sensibly, mcast sockets always reused * Hold-off logic after spawning udp workers removed
2026-10-25Use the new ot_socket abstraction for socket creation, read and writeDirk Engling
2026-10-24Replace custom int64 with its standardized int64_t typeDirk Engling
2026-10-24Replace libowfat's ip scanner and formatters with own ownDirk Engling
2026-10-24Replace libowfat's array with our new blob abstractionDirk Engling
2026-10-24Initialise workstruct for each read, so that stale entries will not linger in http error casesDirk Engling
2026-10-24Use new ranged unsigned int scanner everywhere and squash some bugs along the wayDirk Engling
2026-10-24add missing break in config file parserDirk Engling
2026-10-24Replace all manual hex conversion with the new helperDirk Engling
2026-10-24Use new entropy fascility and add tests for itDirk Engling
2026-10-24Replace endianess helpers and remove unused system and libowfat includedDirk Engling
* Replace libowfat big endian packers with htonl/ntohl * Turn bucket derivation in ot_mutex.c into its own helper * remove unused includes
2026-10-23Rework config file parser and tidy up mem initsDirk Engling
2026-04-03turn all int offsets into size_tDirk Engling
2024-04-16Remove CVS version tags, they did not work anymore after moving to gitDirk Engling
2024-04-15Install default signal handlers before spawning first threadDirk Engling
2024-04-15time_caching_worker never returns, but if it would, it should return a valueDirk Engling
2024-04-15clang-formatDirk Engling
2024-04-14SpellingDirk Engling
2024-04-14print when RANDOMTORRENTS were createdDirk Engling