1
0
forked from bip/bip

Try to detect client side socket kernel buffer fillup

This commit is contained in:
nohar 2005-09-02 12:50:59 +00:00
parent fd91cba6d0
commit 53eaf0d767

View File

@ -223,6 +223,7 @@ static int _write_socket(connection_t *cn, char *message)
{
size_t size;
size_t tcount = 0;
size_t p_tcount = 0;
ssize_t count;
size = strlen(message);
@ -233,6 +234,11 @@ static int _write_socket(connection_t *cn, char *message)
tcount += count;
if (tcount == size)
break;
if (tcount - p_tcount == 0) {
/* no write at all, we give up */
return WRITE_ERROR;
}
p_tcount = tcount;
}
} while (count < 0 &&
(errno == EAGAIN || errno == EINTR || errno == EINPROGRESS));