Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tvh_write: another way to check for write timeouts
  • Loading branch information
perexg committed Jun 2, 2015
1 parent ca84c71 commit 430c894
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/wrappers.c
Expand Up @@ -72,19 +72,14 @@ tvh_pipe_close(th_pipe_t *p)
int
tvh_write(int fd, const void *buf, size_t len)
{
time_t next = dispatch_clock + 25;
ssize_t c;
struct stat st;
int err;
socklen_t errlen;

while (len) {
c = write(fd, buf, len);
if (c < 0) {
if (ERRNO_AGAIN(errno)) {
fstat(fd, &st);
errlen = sizeof(err);
if (S_ISSOCK(st.st_mode) &&
(getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&err, &errlen) || err))
if (dispatch_clock > next)
break;
usleep(100);
continue;
Expand Down

0 comments on commit 430c894

Please sign in to comment.