diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2012-02-10 16:33:27 +0200 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2012-02-10 16:33:27 +0200 |
commit | 724af49cf01c29dae55fb0b4b43d1d265cf4f3f1 (patch) | |
tree | 729e10de198e048a97b7fb3ca2d62a16b98ee613 /extra/yassl/examples/client | |
parent | a25adb1cc830d7e263daa03560a129ac9cd6828a (diff) | |
download | mariadb-git-724af49cf01c29dae55fb0b4b43d1d265cf4f3f1.tar.gz |
Bug #13706828: UPGRADE YASSL FROM 1.7.2 TO 2.1.4
$SUBJ$
1. Took a diff between the previous base version and the
mysql sources.
2. Added the new 2.1.4 base version.
3. Reviewed and re-applied the diff from step #1.
Diffstat (limited to 'extra/yassl/examples/client')
-rw-r--r-- | extra/yassl/examples/client/client.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/extra/yassl/examples/client/client.cpp b/extra/yassl/examples/client/client.cpp index a80a8c2f1a2..d05c31d4d63 100644 --- a/extra/yassl/examples/client/client.cpp +++ b/extra/yassl/examples/client/client.cpp @@ -36,15 +36,20 @@ void ClientError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg) void NonBlockingSSL_Connect(SSL* ssl, SSL_CTX* ctx, SOCKET_T& sockfd) { int ret = SSL_connect(ssl); - while (ret =! SSL_SUCCESS && SSL_get_error(ssl, 0) == - SSL_ERROR_WANT_READ) { - printf("... client would block\n"); + int err = SSL_get_error(ssl, 0); + while (ret != SSL_SUCCESS && (err == SSL_ERROR_WANT_READ || + err == SSL_ERROR_WANT_WRITE)) { + if (err == SSL_ERROR_WANT_READ) + printf("... client would read block\n"); + else + printf("... client would write block\n"); #ifdef _WIN32 Sleep(1000); #else sleep(1); #endif ret = SSL_connect(ssl); + err = SSL_get_error(ssl, 0); } if (ret != SSL_SUCCESS) ClientError(ctx, ssl, sockfd, "SSL_connect failed"); @@ -81,7 +86,8 @@ void client_test(void* args) #ifdef NON_BLOCKING NonBlockingSSL_Connect(ssl, ctx, sockfd); #else - if (SSL_connect(ssl) != SSL_SUCCESS) + // if you get an error here see note at top of README + if (SSL_connect(ssl) != SSL_SUCCESS) ClientError(ctx, ssl, sockfd, "SSL_connect failed"); #endif showPeer(ssl); @@ -105,7 +111,7 @@ void client_test(void* args) int input = SSL_read(ssl, reply, sizeof(reply)); if (input > 0) { reply[input] = 0; - printf("Server response: %s\n", reply); + printf("Server response: %s\n", reply); } #ifdef TEST_RESUME @@ -121,18 +127,18 @@ void client_test(void* args) tcp_connect(sockfd); SSL_set_fd(sslResume, sockfd); SSL_set_session(sslResume, session); - + if (SSL_connect(sslResume) != SSL_SUCCESS) ClientError(ctx, sslResume, sockfd, "SSL_resume failed"); showPeer(sslResume); - + if (SSL_write(sslResume, msg, sizeof(msg)) != sizeof(msg)) ClientError(ctx, sslResume, sockfd, "SSL_write failed"); input = SSL_read(sslResume, reply, sizeof(reply)); if (input > 0) { reply[input] = 0; - printf("Server response: %s\n", reply); + printf("Server response: %s\n", reply); } SSL_shutdown(sslResume); |