mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
UDP loop: epoll on Linux
The UDP loop gave poll() every socket of its sessions each time round. On Linux it now keeps them in an epoll set: the service's socket and each session's socket and parent's control connection are registered once and changed as the session changes, a socket replaced or other events waited for, and an event leads straight to its session. A handler replacing a session's socket marks it to be registered again, as a closed socket leaves the set and its number may come back for the new one; dnspr does so moving on to the next name server. Sessions handed over on a reload leave the set of the old service's loop and are registered by the one adopting them; the service's socket is left unwatched while an older service still serves it. Elsewhere, or built with NOEPOLL, poll() is used as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f5e646ba86
commit
d9b9d1b9b7
3 files changed
+139
-4
No files matched your search
@@ -253,6 +253,11 @@ struct udpsession {
|
||||
int keyed; /* found by its client's address */
|
||||
int done; /* to be ended, param->res saying how */
|
||||
short events; /* polled for on remsock, 0: POLLIN */
|
||||
/* the sockets as the loop watches them (epoll): a handler which
|
||||
replaces param->remsock sets regsock to INVALID_SOCKET, as the number
|
||||
of the one closed may come back for the new one */
|
||||
SOCKET regsock, regctrl;
|
||||
short regevents;
|
||||
void *data; /* the service's own, freed by it in end() */
|
||||
};
|
||||
struct udpservice {
|
||||
|
||||
Reference in new issue
Block a user