mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-28 07:59:41 +08:00
Relays: buffers let go while spliced on a connection's last mapping
sockmap() of fibers and threads kept both buffers for as long as it mapped, even with a direction spliced. On a connection's last mapping (maptail set), as the callbacks already do, a direction spliced lets its empty buffer go: bufdrop(), shared with the callbacks now. It is made again before a read into it, back to copying or draining what TLS held, and both are there again once sockmap() returns, for whatever comes after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1201031404
commit
cbc7245925
4 files changed
+28
-7
No files matched your search
@@ -102,6 +102,20 @@ void buffree(struct clientparam * param){
|
||||
param->clibufdata = param->srvbufdata = NULL;
|
||||
}
|
||||
|
||||
/* An empty own buffer let go, while the connection's last mapping has
|
||||
no use for it, its direction spliced; bufget() makes it again. */
|
||||
void bufdrop(struct clientparam * param, DIRECTION which){
|
||||
unsigned char **own = which? ¶m->srvbufdata : ¶m->clibufdata;
|
||||
unsigned char **buf = which? ¶m->srvbuf : ¶m->clibuf;
|
||||
unsigned *in = which? ¶m->srvinbuf : ¶m->cliinbuf;
|
||||
unsigned *off = which? ¶m->srvoffset : ¶m->clioffset;
|
||||
|
||||
if(!*own || *buf != *own || *in != *off) return;
|
||||
free(*own);
|
||||
*own = *buf = NULL;
|
||||
*in = *off = 0;
|
||||
}
|
||||
|
||||
/* Starts an empty buffer over from its beginning, and goes back to the
|
||||
connection's own buffer if a filter needed a bigger one. Does nothing
|
||||
while anything is left unread. */
|
||||
|
||||
Reference in new issue
Block a user