1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +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_BYTES 0x00100000
#define SSL_DISPLAY_CERTS 0x00200000 #define SSL_DISPLAY_CERTS 0x00200000
#define SSL_DISPLAY_RSA 0x00400000 #define SSL_DISPLAY_RSA 0x00400000
#define SSL_CLIENT_NON_BLOCKING 0x00800000
/* errors that can be generated */ /* errors that can be generated */
#define SSL_OK 0 #define SSL_OK 0

View File

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