mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										40
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								server.c
									
									
									
									
									
								
							@@ -63,7 +63,6 @@ void	server_child_signal(void);
 | 
			
		||||
void	server_child_exited(pid_t, int);
 | 
			
		||||
void	server_child_stopped(pid_t, int);
 | 
			
		||||
void	server_second_callback(int, short, void *);
 | 
			
		||||
void	server_lock_server(void);
 | 
			
		||||
void	server_lock_sessions(void);
 | 
			
		||||
 | 
			
		||||
/* Set marked pane. */
 | 
			
		||||
@@ -505,25 +504,9 @@ server_child_stopped(pid_t pid, int status)
 | 
			
		||||
void
 | 
			
		||||
server_second_callback(unused int fd, unused short events, unused void *arg)
 | 
			
		||||
{
 | 
			
		||||
	struct window		*w;
 | 
			
		||||
	struct window_pane	*wp;
 | 
			
		||||
	struct timeval		 tv;
 | 
			
		||||
 | 
			
		||||
	if (options_get_number(&global_s_options, "lock-server"))
 | 
			
		||||
		server_lock_server();
 | 
			
		||||
	else
 | 
			
		||||
		server_lock_sessions();
 | 
			
		||||
 | 
			
		||||
	RB_FOREACH(w, windows, &windows) {
 | 
			
		||||
		TAILQ_FOREACH(wp, &w->panes, entry) {
 | 
			
		||||
			if (wp->mode != NULL && wp->mode->timer != NULL)
 | 
			
		||||
				wp->mode->timer(wp);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	server_client_status_timer();
 | 
			
		||||
 | 
			
		||||
	format_clean();
 | 
			
		||||
	server_lock_sessions();
 | 
			
		||||
 | 
			
		||||
	evtimer_del(&server_ev_second);
 | 
			
		||||
	memset(&tv, 0, sizeof tv);
 | 
			
		||||
@@ -531,27 +514,6 @@ server_second_callback(unused int fd, unused short events, unused void *arg)
 | 
			
		||||
	evtimer_add(&server_ev_second, &tv);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Lock the server if ALL sessions have hit the time limit. */
 | 
			
		||||
void
 | 
			
		||||
server_lock_server(void)
 | 
			
		||||
{
 | 
			
		||||
	struct session  *s;
 | 
			
		||||
	int		 timeout;
 | 
			
		||||
	time_t           t;
 | 
			
		||||
 | 
			
		||||
	t = time(NULL);
 | 
			
		||||
	RB_FOREACH(s, sessions, &sessions) {
 | 
			
		||||
		if (s->flags & SESSION_UNATTACHED)
 | 
			
		||||
			continue;
 | 
			
		||||
		timeout = options_get_number(&s->options, "lock-after-time");
 | 
			
		||||
		if (timeout <= 0 || t <= s->activity_time.tv_sec + timeout)
 | 
			
		||||
			return;	/* not timed out */
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	server_lock();
 | 
			
		||||
	recalculate_sizes();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Lock any sessions which have timed out. */
 | 
			
		||||
void
 | 
			
		||||
server_lock_sessions(void)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user