mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Event loops: a relayed client's buffers given back while empty
A connection's two data buffers are malloc()'d with it (bufalloc()) instead of being part of struct clientparam, which is CLIENTBUFSIZE*2 smaller. The callbacks' relay of a client whose fiber gave up its stack frees a side's buffer while it is empty and makes it again to read, and gives both back before sockmap() or the child's tail goes on: a pool of idle relayed connections holds no buffers. Fibers and threads keep theirs as before. mix scenarios, callbacks (-L -L2), peak memory before/after, throughput the same: Intel: relay 972/632 MB, connect 981/581, socks 992/594 ARM: relay 1000/673 MB, connect 1000/615, socks 1020/629 struct clientparam's clibufdata and srvbufdata are pointers now: plugins built against the old structure are not compatible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
80c3863055
commit
7963494b1c
7 files changed
+96
-6
No files matched your search
+6
-4
@@ -963,10 +963,12 @@ struct clientparam {
|
||||
something done at once, never for what has to outlive a call into
|
||||
anything that could log. */
|
||||
unsigned char tmpbuf[CLIENTTMPBUFSIZE];
|
||||
/* Each side's data buffer, which clibuf and srvbuf point to unless a
|
||||
filter needed a bigger one. */
|
||||
unsigned char clibufdata[CLIENTBUFSIZE],
|
||||
srvbufdata[CLIENTBUFSIZE];
|
||||
/* Each side's data buffer, CLIENTBUFSIZE of malloc's, which clibuf and
|
||||
srvbuf point to unless a filter needed a bigger one. Made with the
|
||||
connection (bufalloc()); a loop's relay gives an empty one back while
|
||||
nothing but the relay can use it, and makes it again to read. */
|
||||
unsigned char *clibufdata,
|
||||
*srvbufdata;
|
||||
};
|
||||
|
||||
/* Threads whose connections have ended wait here for the next one, with
|
||||
|
||||
Reference in new issue
Block a user