mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 14:27:09 +00:00
Instead of putting dead clients on a list and checking it every loop,
use event_once to queue a callback to deal with them. Also dead clients with references would never actually be freed because the wrap-up functions (the callback for stdin, or status_prompt_clear) would never be called. So call them in server_client_lost.
This commit is contained in:
11
server.c
11
server.c
@ -41,9 +41,7 @@
|
||||
* Main server functions.
|
||||
*/
|
||||
|
||||
/* Client list. */
|
||||
struct clients clients;
|
||||
struct clients dead_clients;
|
||||
|
||||
int server_fd;
|
||||
int server_shutdown;
|
||||
@ -205,7 +203,6 @@ server_start(int lockfd, char *lockfile)
|
||||
RB_INIT(&windows);
|
||||
RB_INIT(&all_window_panes);
|
||||
TAILQ_INIT(&clients);
|
||||
TAILQ_INIT(&dead_clients);
|
||||
RB_INIT(&sessions);
|
||||
RB_INIT(&dead_sessions);
|
||||
TAILQ_INIT(&session_groups);
|
||||
@ -325,7 +322,6 @@ void
|
||||
server_clean_dead(void)
|
||||
{
|
||||
struct session *s, *s1;
|
||||
struct client *c, *c1;
|
||||
|
||||
RB_FOREACH_SAFE(s, sessions, &dead_sessions, s1) {
|
||||
if (s->references != 0)
|
||||
@ -334,13 +330,6 @@ server_clean_dead(void)
|
||||
free(s->name);
|
||||
free(s);
|
||||
}
|
||||
|
||||
TAILQ_FOREACH_SAFE(c, &dead_clients, entry, c1) {
|
||||
if (c->references != 0)
|
||||
continue;
|
||||
TAILQ_REMOVE(&dead_clients, c, entry);
|
||||
free(c);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update socket execute permissions based on whether sessions are attached. */
|
||||
|
Reference in New Issue
Block a user