MINOR: sink: add some comments about sft->appctx usage in applet handlers

There seem to be an ambiguity in the code where sft->appctx would differ
from the appctx that was assigned to it upon appctx creation.

In practise, it doesn't seem this could be happening. Adding a few notes
to come back to this later and try to see if we can remove this
ambiguity.
This commit is contained in:
Aurelien DARRAGON 2024-07-24 17:42:31 +02:00
parent 10811fdfd6
commit b40d804c7f

View File

@ -375,6 +375,7 @@ static void _sink_forward_io_handler(struct appctx *appctx,
HA_SPIN_LOCK(SFT_LOCK, &sft->lock); HA_SPIN_LOCK(SFT_LOCK, &sft->lock);
if (appctx != sft->appctx) { if (appctx != sft->appctx) {
/* FIXME: is this even supposed to happen? */
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock); HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
goto close; goto close;
} }
@ -470,6 +471,8 @@ static int sink_forward_session_init(struct appctx *appctx)
s->uniq_id = 0; s->uniq_id = 0;
applet_expect_no_data(appctx); applet_expect_no_data(appctx);
/* FIXME: redundant? was already assigned in process_sink_forward() */
sft->appctx = appctx; sft->appctx = appctx;
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock); HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
@ -493,6 +496,7 @@ static void sink_forward_session_release(struct appctx *appctx)
HA_SPIN_LOCK(SFT_LOCK, &sft->lock); HA_SPIN_LOCK(SFT_LOCK, &sft->lock);
if (sft->appctx == appctx) if (sft->appctx == appctx)
__sink_forward_session_deinit(sft); __sink_forward_session_deinit(sft);
/* FIXME: is 'sft->appctx != appctx' even supposed to happen? */
HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock); HA_SPIN_UNLOCK(SFT_LOCK, &sft->lock);
} }