[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.30 and 1.31

version 1.30, 2009/09/07 19:08:45 version 1.31, 2009/09/07 21:01:50
Line 43 
Line 43 
   
 /* Client list. */  /* Client list. */
 struct clients   clients;  struct clients   clients;
   struct clients   dead_clients;
   
 void             server_create_client(int);  void             server_create_client(int);
 int              server_create_socket(void);  int              server_create_socket(void);
Line 61 
Line 62 
                       struct window *);                        struct window *);
 int              server_check_window_content(struct session *, struct window *,  int              server_check_window_content(struct session *, struct window *,
                       struct window_pane *);                        struct window_pane *);
   void             server_clean_dead(void);
 void             server_lost_client(struct client *);  void             server_lost_client(struct client *);
 void             server_check_window(struct window *);  void             server_check_window(struct window *);
 void             server_check_redraw(struct client *);  void             server_check_redraw(struct client *);
Line 85 
Line 87 
                 fatal("fcntl failed");                  fatal("fcntl failed");
   
         c = xcalloc(1, sizeof *c);          c = xcalloc(1, sizeof *c);
           c->references = 0;
         imsg_init(&c->ibuf, fd);          imsg_init(&c->ibuf, fd);
   
         ARRAY_INIT(&c->prompt_hdata);          ARRAY_INIT(&c->prompt_hdata);
Line 162 
Line 165 
   
         ARRAY_INIT(&windows);          ARRAY_INIT(&windows);
         ARRAY_INIT(&clients);          ARRAY_INIT(&clients);
           ARRAY_INIT(&dead_clients);
         ARRAY_INIT(&sessions);          ARRAY_INIT(&sessions);
           ARRAY_INIT(&dead_sessions);
         mode_key_init_trees();          mode_key_init_trees();
         key_bindings_init();          key_bindings_init();
         utf8_build();          utf8_build();
Line 344 
Line 349 
   
                 /* Collect any unset key bindings. */                  /* Collect any unset key bindings. */
                 key_bindings_clean();                  key_bindings_clean();
   
                   /* Collect dead clients and sessions. */
                   server_clean_dead();
   
                 /*                  /*
                  * If we have no sessions and clients left, let's get out                   * If we have no sessions and clients left, let's get out
Line 948 
Line 956 
   
         close(c->ibuf.fd);          close(c->ibuf.fd);
         imsg_clear(&c->ibuf);          imsg_clear(&c->ibuf);
         xfree(c);  
   
           for (i = 0; i < ARRAY_LENGTH(&dead_clients); i++) {
                   if (ARRAY_ITEM(&dead_clients, i) == NULL) {
                           ARRAY_SET(&dead_clients, i, c);
                           break;
                   }
           }
           if (i == ARRAY_LENGTH(&dead_clients))
                   ARRAY_ADD(&dead_clients, c);
           c->flags |= CLIENT_DEAD;
   
         recalculate_sizes();          recalculate_sizes();
   }
   
   /* Free dead, unreferenced clients and sessions. */
   void
   server_clean_dead(void)
   {
           struct session  *s;
           struct client   *c;
           u_int            i;
   
           for (i = 0; i < ARRAY_LENGTH(&dead_sessions); i++) {
                   s = ARRAY_ITEM(&dead_sessions, i);
                   if (s == NULL || s->references != 0)
                           continue;
                   ARRAY_SET(&dead_sessions, i, NULL);
                   xfree(s);
           }
   
           for (i = 0; i < ARRAY_LENGTH(&dead_clients); i++) {
                   c = ARRAY_ITEM(&dead_clients, i);
                   if (c == NULL || c->references != 0)
                           continue;
                   ARRAY_SET(&dead_clients, i, NULL);
                   xfree(c);
           }
 }  }
   
 /* Handle window data. */  /* Handle window data. */

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31