Try to detect client side socket kernel buffer fillup
This commit is contained in:
parent
fd91cba6d0
commit
53eaf0d767
@ -223,6 +223,7 @@ static int _write_socket(connection_t *cn, char *message)
|
|||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t tcount = 0;
|
size_t tcount = 0;
|
||||||
|
size_t p_tcount = 0;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
|
|
||||||
size = strlen(message);
|
size = strlen(message);
|
||||||
@ -233,6 +234,11 @@ static int _write_socket(connection_t *cn, char *message)
|
|||||||
tcount += count;
|
tcount += count;
|
||||||
if (tcount == size)
|
if (tcount == size)
|
||||||
break;
|
break;
|
||||||
|
if (tcount - p_tcount == 0) {
|
||||||
|
/* no write at all, we give up */
|
||||||
|
return WRITE_ERROR;
|
||||||
|
}
|
||||||
|
p_tcount = tcount;
|
||||||
}
|
}
|
||||||
} while (count < 0 &&
|
} while (count < 0 &&
|
||||||
(errno == EAGAIN || errno == EINTR || errno == EINPROGRESS));
|
(errno == EAGAIN || errno == EINTR || errno == EINPROGRESS));
|
||||||
|
Loading…
Reference in New Issue
Block a user