1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Check made in ssl_write for EAGAIN return from write().

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@197 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich
2011-01-16 21:44:03 +00:00
parent 529d87ba09
commit faba18dfc1
2 changed files with 24 additions and 17 deletions

View File

@ -939,14 +939,21 @@ static int send_raw_packet(SSL *ssl, uint8_t protocol)
while (sent < pkt_size)
{
if ((ret = SOCKET_WRITE(ssl->client_fd,
&ssl->bm_all_data[sent], pkt_size)) < 0)
{
ret = SSL_ERROR_CONN_LOST;
break;
}
ret = SOCKET_WRITE(ssl->client_fd,
&ssl->bm_all_data[sent], pkt_size);
sent += ret;
if (ret >= 0)
sent += ret;
else
{
#ifdef WIN32
if (GetLastError() != WSAEWOULDBLOCK)
#else
if (errno != EAGAIN && errno != EWOULDBLOCK)
#endif
return SSL_ERROR_CONN_LOST;
}
/* keep going until the write buffer has some space */
if (sent != pkt_size)
@ -955,11 +962,9 @@ static int send_raw_packet(SSL *ssl, uint8_t protocol)
FD_ZERO(&wfds);
FD_SET(ssl->client_fd, &wfds);
/* block and wait for it */
if (select(ssl->client_fd + 1, NULL, &wfds, NULL, NULL) < 0)
{
ret = SSL_ERROR_CONN_LOST;
break;
}
return SSL_ERROR_CONN_LOST;
}
}