Skip to content

Commit 813ce48

Browse files
committed
proxy: remove timeout alarm on reset/cleanup
need to catch cases where errors happen inbetween timeout being set and then remove or triggered... which should be impossible but just in case.
1 parent d839799 commit 813ce48

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

proxy_luafgen.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ static void mcp_rcontext_cleanup(lua_State *L, mcp_funcgen_t *fgen, mcp_rcontext
109109
}
110110
}
111111

112+
// nuke alarm if set.
113+
// should only be paranoia here, but just in case.
114+
if (event_pending(&rctx->timeout_event, EV_TIMEOUT, NULL)) {
115+
event_del(&rctx->timeout_event);
116+
}
117+
112118
lua_getiuservalue(L, fgen_idx, 1);
113119
luaL_unref(L, -1, rctx->self_ref);
114120
rctx->self_ref = 0;
@@ -314,6 +320,11 @@ static void _mcp_funcgen_return_rctx(mcp_rcontext_t *rctx) {
314320
mcp_request_cleanup(fgen->thread, rctx->request);
315321
}
316322

323+
// nuke alarm if set.
324+
if (event_pending(&rctx->timeout_event, EV_TIMEOUT, NULL)) {
325+
event_del(&rctx->timeout_event);
326+
}
327+
317328
// reset each rqu.
318329
for (int x = 0; x < fgen->max_queues; x++) {
319330
struct mcp_rqueue_s *rqu = &rctx->qslots[x];

0 commit comments

Comments
 (0)