Switch tty fds over to a bufferevent.

This commit is contained in:
Nicholas Marriott
2009-11-04 21:47:42 +00:00
parent abb728684b
commit 7342615c7d
5 changed files with 38 additions and 45 deletions

View File

@ -136,8 +136,7 @@ server_client_lost(struct client *c)
close(c->ibuf.fd);
imsg_clear(&c->ibuf);
event_del(&c->event);
event_del(&c->tty.event);
for (i = 0; i < ARRAY_LENGTH(&dead_clients); i++) {
if (ARRAY_ITEM(&dead_clients, i) == NULL) {
ARRAY_SET(&dead_clients, i, c);
@ -172,18 +171,6 @@ server_client_prepare(void)
event_set(&c->event,
c->ibuf.fd, events, server_client_callback, c);
event_add(&c->event, NULL);
if (c->tty.fd == -1)
continue;
if (c->flags & CLIENT_SUSPENDED || c->session == NULL)
continue;
events = EV_READ;
if (BUFFER_USED(c->tty.out) > 0)
events |= EV_WRITE;
event_del(&c->tty.event);
event_set(&c->tty.event,
c->tty.fd, events, server_client_callback, c);
event_add(&c->tty.event, NULL);
}
}
@ -209,14 +196,6 @@ server_client_callback(int fd, short events, void *data)
if (events & EV_READ && server_client_msg_dispatch(c) != 0)
goto client_lost;
}
if (c->tty.fd != -1 && fd == c->tty.fd) {
if (c->flags & CLIENT_SUSPENDED || c->session == NULL)
return;
if (buffer_poll(fd, events, c->tty.in, c->tty.out) != 0)
goto client_lost;
}
return;