Try write even if read gets signal, some other tweaks.

This commit is contained in:
Nicholas Marriott
2007-11-07 19:41:17 +00:00
parent 08d9f46aae
commit 35591ecd4e
4 changed files with 13 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $Id: buffer-poll.c,v 1.1.1.1 2007-07-09 19:04:12 nicm Exp $ */
/* $Id: buffer-poll.c,v 1.2 2007-11-07 19:41:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -40,18 +40,16 @@ buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
if (n == -1) {
if (errno != EINTR && errno != EAGAIN)
return (-1);
return (0);
}
buffer_add(in, n);
} else
buffer_add(in, n);
}
if (BUFFER_USED(out) > 0 && pfd->revents & POLLOUT) {
n = write(pfd->fd, BUFFER_OUT(out), BUFFER_USED(out));
if (n == -1) {
if (errno != EINTR && errno != EAGAIN)
return (-1);
return (0);
}
buffer_remove(out, n);
} else
buffer_remove(out, n);
}
return (0);
}