[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.17 and 1.18

version 1.17, 2009/08/10 19:42:03 version 1.18, 2009/08/11 17:18:35
Line 85 
Line 85 
                 fatal("fcntl failed");                  fatal("fcntl failed");
   
         c = xcalloc(1, sizeof *c);          c = xcalloc(1, sizeof *c);
         c->fd = fd;          imsg_init(&c->ibuf, fd);
         c->in = buffer_create(BUFSIZ);  
         c->out = buffer_create(BUFSIZ);  
   
         ARRAY_INIT(&c->prompt_hdata);          ARRAY_INIT(&c->prompt_hdata);
   
Line 672 
Line 670 
                 if (c == NULL)                  if (c == NULL)
                         (*pfd)->fd = -1;                          (*pfd)->fd = -1;
                 else {                  else {
                         (*pfd)->fd = c->fd;                          (*pfd)->fd = c->ibuf.fd;
                         if (!(c->flags & CLIENT_BAD))                          if (!(c->flags & CLIENT_BAD))
                                 (*pfd)->events = POLLIN;                                  (*pfd)->events |= POLLIN;
                         if (BUFFER_USED(c->out) > 0)                          if (c->ibuf.w.queued > 0)
                                 (*pfd)->events |= POLLOUT;                                  (*pfd)->events |= POLLOUT;
                 }                  }
                 (*pfd)++;                  (*pfd)++;
Line 718 
Line 716 
                 c = ARRAY_ITEM(&clients, i);                  c = ARRAY_ITEM(&clients, i);
   
                 if (c != NULL) {                  if (c != NULL) {
                         if (buffer_poll(*pfd, c->in, c->out) != 0) {                          if ((*pfd)->revents & (POLLERR|POLLNVAL|POLLHUP)) {
                                 server_lost_client(c);                                  server_lost_client(c);
                                 (*pfd) += 2;                                  (*pfd) += 2;
                                 continue;                                  continue;
                         } else if (c->flags & CLIENT_BAD) {                          }
                                 if (BUFFER_USED(c->out) == 0)  
                           if ((*pfd)->revents & POLLOUT) {
                                   if (msgbuf_write(&c->ibuf.w) < 0) {
                                         server_lost_client(c);                                          server_lost_client(c);
                                           (*pfd) += 2;
                                           continue;
                                   }
                           }
   
                           if (c->flags & CLIENT_BAD) {
                                   if (c->ibuf.w.queued == 0)
                                           server_lost_client(c);
                                 (*pfd) += 2;                                  (*pfd) += 2;
                                 continue;                                  continue;
                         } else                          } else if ((*pfd)->revents & POLLIN) {
                                 server_msg_dispatch(c);                                  if (server_msg_dispatch(c) != 0) {
                                           server_lost_client(c);
                                           (*pfd) += 2;
                                           continue;
                                   }
                           }
                 }                  }
                 (*pfd)++;                  (*pfd)++;
   
Line 910 
Line 923 
         if (c->cwd != NULL)          if (c->cwd != NULL)
                 xfree(c->cwd);                  xfree(c->cwd);
   
         close(c->fd);          close(c->ibuf.fd);
         buffer_destroy(c->in);          imsg_clear(&c->ibuf);
         buffer_destroy(c->out);  
         xfree(c);          xfree(c);
   
         recalculate_sizes();          recalculate_sizes();

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18