Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-client-mbedtls by
Diff: source/m2mconnectionsecuritypimpl.cpp
- Revision:
- 6:80a66815c791
- Parent:
- 5:840aa460b437
--- a/source/m2mconnectionsecuritypimpl.cpp Thu Apr 07 02:01:28 2016 +0300
+++ b/source/m2mconnectionsecuritypimpl.cpp Thu Apr 07 11:05:45 2016 +0000
@@ -21,7 +21,7 @@
#include "mbed-trace/mbed_trace.h"
#include <string.h>
-#define TRACEW_GROUP "mClt"
+#define TRACE_GROUP "mClt"
void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
int mbedtls_timing_get_delay( void *data );
@@ -237,11 +237,19 @@
mbedtls_ssl_set_timer_cb( &_ssl, _timer, mbedtls_timing_set_delay,
mbedtls_timing_get_delay );
- do ret = mbedtls_ssl_handshake( &_ssl );
+ int retry_count = 0;
+ do
+ {
+ ret = mbedtls_ssl_handshake( &_ssl );
+ if (ret == -1) {
+ mbedtls_ssl_session_reset( &_ssl );
+ retry_count++;
+ tr_error("M2MConnectionSecurityPimpl::connect - start handshake again");
+ }
+ }
while( ret == MBEDTLS_ERR_SSL_WANT_READ ||
- ret == MBEDTLS_ERR_SSL_WANT_WRITE );
-
- tr_debug("M2MConnectionSecurityPimpl::connect - handshake, ret: %d", ret);
+ ret == MBEDTLS_ERR_SSL_WANT_WRITE ||
+ (ret == -1 && retry_count <= RETRY_COUNT));
if( ret != 0 ) {
tr_error("M2MConnectionSecurityPimpl::connect - handshake failed");
