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

@ -183,7 +183,7 @@ static X509 *mySSL_get_cert(SSL *ssl)
static int _write_socket_SSL(connection_t *cn, char* message) static int _write_socket_SSL(connection_t *cn, char* message)
{ {
int count, size; int count, size;
size = sizeof(char)*strlen(message); size = sizeof(char)*strlen(message);
if (!cn->client && cn->cert == NULL) { if (!cn->client && cn->cert == NULL) {
@ -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));