diff --git a/examples/client/client.c b/examples/client/client.c index 057700197..3aa2afa62 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -3095,25 +3095,33 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) err = wolfSSL_get_error(ssl, 0); if (err == WOLFSSL_ERROR_WANT_READ || err == WOLFSSL_ERROR_WANT_WRITE) { - (void)ClientWrite(ssl, + ret = ClientWrite(ssl, "msg sent during renegotiation", sizeof("msg sent during renegotiation") - 1, "", 1); - do { - if (err == APP_DATA_READY) { - if ((ret = wolfSSL_read(ssl, reply, sizeof(reply)-1)) < 0) { - err_sys("APP DATA should be present but error returned"); + if (ret != 0) { + ret = WOLFSSL_FAILURE; + } + else { + do { + if (err == APP_DATA_READY) { + if ((ret = wolfSSL_read(ssl, reply, + sizeof(reply)-1)) < 0) { + err_sys("APP DATA should be present " + "but error returned"); + } + printf("Received message: %s\n", reply); } - printf("Received message: %s\n", reply); - } - err = 0; - if ((ret = wolfSSL_connect(ssl)) != WOLFSSL_SUCCESS) { - err = wolfSSL_get_error(ssl, ret); - } - } while (ret != WOLFSSL_SUCCESS && - (err == WOLFSSL_ERROR_WANT_READ || + err = 0; + if ((ret = wolfSSL_connect(ssl)) + != WOLFSSL_SUCCESS) { + err = wolfSSL_get_error(ssl, ret); + } + } while (ret != WOLFSSL_SUCCESS && + (err == WOLFSSL_ERROR_WANT_READ || err == WOLFSSL_ERROR_WANT_WRITE || err == APP_DATA_READY)); + } if (ret != WOLFSSL_SUCCESS) { err = wolfSSL_get_error(ssl, 0); diff --git a/src/internal.c b/src/internal.c index 3cdba396e..dedee911e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -17870,6 +17870,7 @@ int ReceiveData(WOLFSSL* ssl, byte* output, int sz, int peek) startScr: if (ssl->secure_renegotiation && ssl->secure_renegotiation->startScr) { int ret; + WOLFSSL_MSG("Need to start scr, server requested"); ret = wolfSSL_Rehandshake(ssl); ssl->secure_renegotiation->startScr = 0; /* only start once */ if (ret != WOLFSSL_SUCCESS)