Do not let a stuck client prevent the server from exiting - give up

after 10 seconds. GitHub issue 5444 from Ben Maurer.
This commit is contained in:
nicm
2026-08-03 20:18:20 +00:00
committed by tmux update bot
parent 6db5175e4e
commit 114aa68082
3 changed files with 68 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: control.c,v 1.63 2026/08/03 13:38:42 nicm Exp $ */
/* $OpenBSD: control.c,v 1.64 2026/08/03 20:18:20 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -968,6 +968,23 @@ control_discard(struct client *c)
bufferevent_disable(cs->read_event, EV_READ);
}
/*
* Discard all output for a client, including output which has already been
* queued to be written.
*/
void
control_discard_all(struct client *c)
{
struct control_state *cs = c->control_state;
struct control_block *cb, *cb1;
struct evbuffer *evb = cs->write_event->output;
control_discard(c);
TAILQ_FOREACH_SAFE(cb, &cs->all_blocks, all_entry, cb1)
control_free_block(cs, cb);
evbuffer_drain(evb, EVBUFFER_LENGTH(evb));
}
/* Stop control mode. */
void
control_stop(struct client *c)