aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Frank <fabian@pagefault.de>2014-02-14 01:20:20 -0800
committerDaniel Stenberg <daniel@haxx.se>2014-02-16 23:30:21 +0100
commit86f266b00495277d3c797ecb565f21d60ac38332 (patch)
treea22237b72f695f3f0e065e6b39dd970faf716d46
parent79a9f8c94273995cdccbbde87e251f1ea4a2700d (diff)
axtls: call ssl_read repeatedly
Perform more work in between sleeps. This is work around the fact that axtls does not expose any knowledge about when work needs to be performed. Depending on connection and how often perform is being called this can save ~25% of time on SSL handshakes (measured on 20ms latency connection calling perform roughly every 10ms).
-rw-r--r--lib/vtls/axtls.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/vtls/axtls.c b/lib/vtls/axtls.c
index d5d6db2ff..73602a4e7 100644
--- a/lib/vtls/axtls.c
+++ b/lib/vtls/axtls.c
@@ -398,6 +398,7 @@ CURLcode Curl_axtls_connect_nonblocking(
{
CURLcode conn_step;
int ssl_fcn_return;
+ int i;
*done = FALSE;
/* connectdata is calloc'd and connecting_state is only changed in this
@@ -414,14 +415,14 @@ CURLcode Curl_axtls_connect_nonblocking(
if(conn->ssl[sockindex].connecting_state == ssl_connect_2) {
/* Check to make sure handshake was ok. */
if(ssl_handshake_status(conn->ssl[sockindex].ssl) != SSL_OK) {
- ssl_fcn_return = ssl_read(conn->ssl[sockindex].ssl, NULL);
- if(ssl_fcn_return < 0) {
- Curl_axtls_close(conn, sockindex);
- ssl_display_error(ssl_fcn_return); /* goes to stdout. */
- return map_error_to_curl(ssl_fcn_return);
- }
- else {
- return CURLE_OK; /* Return control to caller for retries */
+ for(i=0; i<5; i++) {
+ ssl_fcn_return = ssl_read(conn->ssl[sockindex].ssl, NULL);
+ if(ssl_fcn_return < 0) {
+ Curl_axtls_close(conn, sockindex);
+ ssl_display_error(ssl_fcn_return); /* goes to stdout. */
+ return map_error_to_curl(ssl_fcn_return);
+ }
+ return CURLE_OK;
}
}
infof (conn->data, "handshake completed successfully\n");