version 1.45, 2009/10/10 09:31:39 |
version 1.46, 2009/10/10 09:46:11 |
|
|
void server_check_redraw(struct client *); |
void server_check_redraw(struct client *); |
void server_set_title(struct client *); |
void server_set_title(struct client *); |
void server_check_timers(struct client *); |
void server_check_timers(struct client *); |
|
void server_lock_server(void); |
|
void server_lock_sessions(void); |
void server_second_timers(void); |
void server_second_timers(void); |
int server_update_socket(void); |
int server_update_socket(void); |
|
|
|
|
key_bindings_init(); |
key_bindings_init(); |
utf8_build(); |
utf8_build(); |
|
|
server_activity = time(NULL); |
|
|
|
start_time = time(NULL); |
start_time = time(NULL); |
socket_path = path; |
socket_path = path; |
|
|
|
|
/* Process keys. */ |
/* Process keys. */ |
keylist = options_get_data(&c->session->options, "prefix"); |
keylist = options_get_data(&c->session->options, "prefix"); |
while (tty_keys_next(&c->tty, &key, mouse) == 0) { |
while (tty_keys_next(&c->tty, &key, mouse) == 0) { |
server_activity = time(NULL); |
|
|
|
if (c->session == NULL) |
if (c->session == NULL) |
return; |
return; |
|
|
|
c->session->activity = time(NULL); |
w = c->session->curw->window; |
w = c->session->curw->window; |
wp = w->active; /* could die */ |
wp = w->active; /* could die */ |
|
|
|
|
recalculate_sizes(); |
recalculate_sizes(); |
} |
} |
|
|
|
/* Lock the server if ALL sessions have hit the time limit. */ |
|
void |
|
server_lock_server(void) |
|
{ |
|
struct session *s; |
|
u_int i; |
|
int timeout; |
|
time_t t; |
|
|
|
t = time(NULL); |
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { |
|
if ((s = ARRAY_ITEM(&sessions, i)) == NULL) |
|
continue; |
|
|
|
timeout = options_get_number(&s->options, "lock-after-time"); |
|
if (timeout <= 0 || t <= s->activity + timeout) |
|
return; /* not timed out */ |
|
} |
|
|
|
server_lock(); |
|
recalculate_sizes(); |
|
} |
|
|
|
/* Lock any sessions which have timed out. */ |
|
void |
|
server_lock_sessions(void) |
|
{ |
|
struct session *s; |
|
u_int i; |
|
int timeout; |
|
time_t t; |
|
|
|
t = time(NULL); |
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { |
|
if ((s = ARRAY_ITEM(&sessions, i)) == NULL) |
|
continue; |
|
|
|
timeout = options_get_number(&s->options, "lock-after-time"); |
|
if (timeout > 0 && t > s->activity + timeout) { |
|
server_lock_session(s); |
|
recalculate_sizes(); |
|
} |
|
} |
|
} |
|
|
/* Call any once-per-second timers. */ |
/* Call any once-per-second timers. */ |
void |
void |
server_second_timers(void) |
server_second_timers(void) |
|
|
struct window *w; |
struct window *w; |
struct window_pane *wp; |
struct window_pane *wp; |
u_int i; |
u_int i; |
int xtimeout; |
|
time_t t; |
|
|
|
t = time(NULL); |
if (options_get_number(&global_s_options, "lock-server")) |
|
server_lock_server(); |
xtimeout = options_get_number(&global_s_options, "lock-after-time"); |
else |
if (xtimeout > 0 && t > server_activity + xtimeout) { |
server_lock_sessions(); |
server_lock(); |
|
recalculate_sizes(); |
|
} |
|
|
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) { |
for (i = 0; i < ARRAY_LENGTH(&windows); i++) { |
w = ARRAY_ITEM(&windows, i); |
w = ARRAY_ITEM(&windows, i); |