mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +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:
parent
529d87ba09
commit
faba18dfc1
14
ssl/ssl.h
14
ssl/ssl.h
@ -197,8 +197,8 @@ extern "C" {
|
||||
* are passed during a handshake.
|
||||
* - SSL_DISPLAY_RSA (full mode build only): Display the RSA key details that
|
||||
* are passed during a handshake.
|
||||
* - SSL_CLIENT_NON_BLOCKING (client only): Use non-blocking version of
|
||||
* ssl_client_new.
|
||||
* - SSL_CLIENT_NON_BLOCKING (client only): To use a non-blocking version of
|
||||
* ssl_client_new().
|
||||
* @param num_sessions [in] The number of sessions to be used for session
|
||||
* caching. If this value is 0, then there is no session caching. This option
|
||||
* is not used in skeleton mode.
|
||||
@ -232,9 +232,9 @@ EXP_FUNC SSL * STDCALL ssl_server_new(SSL_CTX *ssl_ctx, int client_fd);
|
||||
* It is up to the application to establish the initial logical connection
|
||||
* (whether it is a socket, serial connection etc).
|
||||
*
|
||||
* This is a normall a blocking call - it will finish when the handshake is
|
||||
* This is a normally a blocking call - it will finish when the handshake is
|
||||
* complete (or has failed). To use in non-blocking mode, set
|
||||
* SSL_CLIENT_NON_BLOCKING in ssl_ctx_new.
|
||||
* SSL_CLIENT_NON_BLOCKING in ssl_ctx_new().
|
||||
* @param ssl_ctx [in] The client context.
|
||||
* @param client_fd [in] The client's file descriptor.
|
||||
* @param session_id [in] A 32 byte session id for session resumption. This
|
||||
@ -257,7 +257,8 @@ EXP_FUNC void STDCALL ssl_free(SSL *ssl);
|
||||
|
||||
/**
|
||||
* @brief Read the SSL data stream.
|
||||
* The socket must be in blocking mode.
|
||||
* If the socket is non-blocking and data is blocked then SSO_OK will be
|
||||
* returned.
|
||||
* @param ssl [in] An SSL object reference.
|
||||
* @param in_data [out] If the read was successful, a pointer to the read
|
||||
* buffer will be here. Do NOT ever free this memory as this buffer is used in
|
||||
@ -274,7 +275,8 @@ EXP_FUNC int STDCALL ssl_read(SSL *ssl, uint8_t **in_data);
|
||||
|
||||
/**
|
||||
* @brief Write to the SSL data stream.
|
||||
* The socket must be in blocking mode.
|
||||
* if the socket is non-blocking and data is blocked then a check is made
|
||||
* to ensure that all data is sent (i.e. blocked mode is forced).
|
||||
* @param ssl [in] An SSL obect reference.
|
||||
* @param out_data [in] The data to be written
|
||||
* @param out_len [in] The number of bytes to be written.
|
||||
|
25
ssl/tls1.c
25
ssl/tls1.c
@ -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);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user