[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.48 and 1.49

version 1.48, 2009/10/10 14:51:16 version 1.49, 2009/10/10 15:03:01
Line 72 
Line 72 
 void             server_handle_windows(void);  void             server_handle_windows(void);
 void             server_fill_clients(void);  void             server_fill_clients(void);
 void             server_handle_clients(void);  void             server_handle_clients(void);
   void             server_fill_jobs(void);
   void             server_fill_jobs1(struct jobs *);
   void             server_handle_jobs(void);
   void             server_handle_jobs1(struct jobs *);
 void             server_accept_client(int);  void             server_accept_client(int);
 void             server_handle_client(struct client *);  void             server_handle_client(struct client *);
 void             server_handle_window(struct window *, struct window_pane *);  void             server_handle_window(struct window *, struct window_pane *);
Line 190 
Line 194 
         c->session = NULL;          c->session = NULL;
         c->tty.sx = 80;          c->tty.sx = 80;
         c->tty.sy = 24;          c->tty.sy = 24;
   
         screen_init(&c->status, c->tty.sx, 1, 0);          screen_init(&c->status, c->tty.sx, 1, 0);
           job_tree_init(&c->status_jobs);
   
         c->message_string = NULL;          c->message_string = NULL;
   
Line 370 
Line 376 
                 server_poll_add(srv_fd, POLLIN);                  server_poll_add(srv_fd, POLLIN);
   
                 /* Fill window and client sockets. */                  /* Fill window and client sockets. */
                   server_fill_jobs();
                 server_fill_windows();                  server_fill_windows();
                 server_fill_clients();                  server_fill_clients();
   
Line 412 
Line 419 
                  * windows, so windows must come first to avoid messing up by                   * windows, so windows must come first to avoid messing up by
                  * increasing the array size.                   * increasing the array size.
                  */                   */
                   server_handle_jobs();
                 server_handle_windows();                  server_handle_windows();
                 server_handle_clients();                  server_handle_clients();
   
Line 648 
Line 656 
   
         template = options_get_string(&s->options, "set-titles-string");          template = options_get_string(&s->options, "set-titles-string");
   
         title = status_replace(c->session, template, time(NULL));          title = status_replace(c, template, time(NULL));
         if (c->title == NULL || strcmp(title, c->title) != 0) {          if (c->title == NULL || strcmp(title, c->title) != 0) {
                 if (c->title != NULL)                  if (c->title != NULL)
                         xfree(c->title);                          xfree(c->title);
Line 663 
Line 671 
 server_check_timers(struct client *c)  server_check_timers(struct client *c)
 {  {
         struct session  *s;          struct session  *s;
           struct job      *job;
         struct timeval   tv;          struct timeval   tv;
         u_int            interval;          u_int            interval;
   
Line 694 
Line 703 
         if (interval == 0)          if (interval == 0)
                 return;                  return;
         if (tv.tv_sec < c->status_timer.tv_sec ||          if (tv.tv_sec < c->status_timer.tv_sec ||
             ((u_int) tv.tv_sec) - c->status_timer.tv_sec >= interval)              ((u_int) tv.tv_sec) - c->status_timer.tv_sec >= interval) {
                   /* Run the jobs for this client and schedule for redraw. */
                   RB_FOREACH(job, jobs, &c->status_jobs)
                           job_run(job);
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
           }
 }  }
   
 /* Fill client pollfds. */  /* Fill client pollfds. */
Line 747 
Line 760 
         }          }
 }  }
   
   /* Fill in job fds. */
   void
   server_fill_jobs(void)
   {
           struct client   *c;
           u_int            i;
   
           for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                   c = ARRAY_ITEM(&clients, i);
                   if (c != NULL)
                           server_fill_jobs1(&c->status_jobs);
           }
   }
   
   void
   server_fill_jobs1(struct jobs *jobs)
   {
           struct job      *job;
   
           RB_FOREACH(job, jobs, jobs) {
                   if (job->fd == -1)
                           continue;
                   server_poll_add(job->fd, POLLIN);
           }
   }
   
   /* Handle job fds. */
   void
   server_handle_jobs(void)
   {
           struct client   *c;
           u_int            i;
   
           for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                   c = ARRAY_ITEM(&clients, i);
                   if (c != NULL)
                           server_handle_jobs1(&c->status_jobs);
           }
   }
   
   void
   server_handle_jobs1(struct jobs *jobs)
   {
           struct job      *job;
           struct pollfd   *pfd;
   
           RB_FOREACH(job, jobs, jobs) {
                   if (job->fd == -1)
                           continue;
                   if ((pfd = server_poll_lookup(job->fd)) == NULL)
                           continue;
                   if (buffer_poll(pfd, job->out, NULL) != 0) {
                           close(job->fd);
                           job->fd = -1;
                           if (job->callbackfn != NULL)
                                   job->callbackfn(job);
                   }
           }
   }
   
 /* Handle client pollfds. */  /* Handle client pollfds. */
 void  void
 server_handle_clients(void)  server_handle_clients(void)
Line 991 
Line 1064 
                 tty_free(&c->tty);                  tty_free(&c->tty);
   
         screen_free(&c->status);          screen_free(&c->status);
           job_tree_free(&c->status_jobs);
   
         if (c->title != NULL)          if (c->title != NULL)
                 xfree(c->title);                  xfree(c->title);

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49