mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-28 07:59:41 +08:00
Event loops: sockmap() as callbacks, a draft (-L2, loopmode cb)
The data of a connection mapped by a fiber of a loop is relayed by the loop itself, on its own stack: the sockets registered with it call back a relay moving what they are ready for, a read and a write each way a round, up to 16 rounds before the rest waits for the loop's next turn. The fiber, parked meanwhile, is resumed once the mapping is over, as sockmap() would end it, with its result: the idle timeout, shortened to LINGER_TO once a side has ended, half-close or not as the service has it, errors, and data left. Only a plain relay: with filters, limits of bandwidth or traffic, grace, dumps to the log, TLS or anything else between the socket functions of the system, a control socket or a body of known length, sockmap() maps it itself. No splice() yet: data is copied, so it compares with -s0. The fiber keeps its stack. For benchmarks: -L2 on a service (with -L for the count of loops), or loopmode cb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f27d2cbfb
commit
23e83a6b02
5 files changed
+236
-2
No files matched your search
+2
-1
@@ -480,7 +480,8 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
|
||||
srv->stacksize = atoi(argv[i]+2);
|
||||
break;
|
||||
case 'L':
|
||||
srv->loopmode = argv[i][2] != '0';
|
||||
/* -L2: and their data relayed by the loop (a draft) */
|
||||
srv->loopmode = argv[i][2]? atoi(argv[i]+2) : 1;
|
||||
break;
|
||||
case 'a':
|
||||
srv->anonymous = 1 + atoi(argv[i]+2);
|
||||
|
||||
Reference in new issue
Block a user