[BACK]Return to server.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/server.c between version 1.140 and 1.141

version 1.140, 2015/10/11 00:26:23 version 1.141, 2015/10/22 10:46:24
Line 44 
Line 44 
 struct clients   clients;  struct clients   clients;
   
 int              server_fd;  int              server_fd;
 int              server_shutdown;  int              server_exit;
 struct event     server_ev_accept;  struct event     server_ev_accept;
   
 struct session          *marked_session;  struct session          *marked_session;
Line 55 
Line 55 
   
 int     server_create_socket(void);  int     server_create_socket(void);
 void    server_loop(void);  void    server_loop(void);
 int     server_should_shutdown(void);  int     server_should_exit(void);
 void    server_send_shutdown(void);  void    server_send_exit(void);
 void    server_accept_callback(int, short, void *);  void    server_accept_callback(int, short, void *);
 void    server_signal_callback(int, short, void *);  void    server_signal_callback(int, short, void *);
 void    server_child_signal(void);  void    server_child_signal(void);
Line 232 
Line 232 
 void  void
 server_loop(void)  server_loop(void)
 {  {
         while (!server_should_shutdown()) {          while (!server_should_exit()) {
                 log_debug("event dispatch enter");                  log_debug("event dispatch enter");
                 event_loop(EVLOOP_ONCE);                  event_loop(EVLOOP_ONCE);
                 log_debug("event dispatch exit");                  log_debug("event dispatch exit");
Line 243 
Line 243 
   
 /* Check if the server should exit (no more clients or sessions). */  /* Check if the server should exit (no more clients or sessions). */
 int  int
 server_should_shutdown(void)  server_should_exit(void)
 {  {
         struct client   *c;          struct client   *c;
   
Line 268 
Line 268 
         return (1);          return (1);
 }  }
   
 /* Shutdown the server by killing all clients and windows. */  /* Exit the server by killing all clients and windows. */
 void  void
 server_send_shutdown(void)  server_send_exit(void)
 {  {
         struct client   *c, *c1;          struct client   *c, *c1;
         struct session  *s, *s1;          struct session  *s, *s1;
Line 281 
Line 281 
                 if (c->flags & (CLIENT_BAD|CLIENT_SUSPENDED))                  if (c->flags & (CLIENT_BAD|CLIENT_SUSPENDED))
                         server_client_lost(c);                          server_client_lost(c);
                 else                  else
                         server_write_client(c, MSG_SHUTDOWN, NULL, 0);                          server_write_client(c, MSG_EXIT, NULL, 0);
                 c->session = NULL;                  c->session = NULL;
         }          }
   
Line 348 
Line 348 
                 }                  }
                 fatal("accept failed");                  fatal("accept failed");
         }          }
         if (server_shutdown) {          if (server_exit) {
                 close(newfd);                  close(newfd);
                 return;                  return;
         }          }
Line 386 
Line 386 
   
         switch (sig) {          switch (sig) {
         case SIGTERM:          case SIGTERM:
                 server_shutdown = 1;                  server_exit = 1;
                 server_send_shutdown();                  server_send_exit();
                 break;                  break;
         case SIGCHLD:          case SIGCHLD:
                 server_child_signal();                  server_child_signal();

Legend:
Removed from v.1.140  
changed lines
  Added in v.1.141