1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Allow non-blocked ssl_client_new() operation.

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@194 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2011-01-14 13:57:34 +00:00
parent 7ddde6ec6b
commit f2dabd56b7
2 changed files with 17 additions and 13 deletions

View File

@ -82,6 +82,7 @@ extern "C" {
#define SSL_DISPLAY_BYTES 0x00100000
#define SSL_DISPLAY_CERTS 0x00200000
#define SSL_DISPLAY_RSA 0x00400000
#define SSL_CLIENT_NON_BLOCKING 0x00800000
/* errors that can be generated */
#define SSL_OK 0

View File

@ -151,23 +151,26 @@ int do_client_connect(SSL *ssl)
ssl->hs_status = SSL_NOT_OK; /* not connected */
/* sit in a loop until it all looks good */
while (ssl->hs_status != SSL_OK)
if (!IS_SET_SSL_FLAG(SSL_CLIENT_NON_BLOCKING))
{
ret = basic_read(ssl, NULL);
if (ret < SSL_OK)
while (ssl->hs_status != SSL_OK)
{
if (ret != SSL_ERROR_CONN_LOST)
{
/* let the server know we are dying and why */
if (send_alert(ssl, ret))
{
/* something nasty happened, so get rid of it */
kill_ssl_session(ssl->ssl_ctx->ssl_sessions, ssl);
}
}
ret = basic_read(ssl, NULL);
break;
if (ret < SSL_OK)
{
if (ret != SSL_ERROR_CONN_LOST)
{
/* let the server know we are dying and why */
if (send_alert(ssl, ret))
{
/* something nasty happened, so get rid of it */
kill_ssl_session(ssl->ssl_ctx->ssl_sessions, ssl);
}
}
break;
}
}
}