Skip to content

Commit a7beb20

Browse files
authored
Merge pull request #10451 from Frauschi/fix/client-nonblocking-resume-err
Minor error handling fixes in client and server examples
2 parents 75f32a3 + d88ce69 commit a7beb20

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

examples/client/client.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
849849
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_write(ssl, tx_buffer, len),
850850
ret <= 0);
851851
if (ret != len) {
852+
err = wolfSSL_get_error(ssl, 0);
852853
LOG_ERROR("SSL_write bench error %d!\n", err);
853854
if (!exitWithRet)
854855
err_sys("SSL_write failed");
@@ -912,7 +913,11 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
912913
XFREE(rx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
913914
}
914915
else {
915-
err_sys("wolfSSL_connect failed");
916+
err = wolfSSL_get_error(ssl, 0);
917+
LOG_ERROR("wolfSSL_connect error %d, %s\n", err,
918+
wolfSSL_ERR_error_string((unsigned long)err, NULL));
919+
if (!exitWithRet)
920+
err_sys("wolfSSL_connect failed");
916921
}
917922

918923
wolfSSL_shutdown(ssl);
@@ -4884,6 +4889,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
48844889
ret = NonBlockingSSL_Connect(sslResume); /* will keep retrying on timeout */
48854890
#endif
48864891
if (ret != WOLFSSL_SUCCESS) {
4892+
err = wolfSSL_get_error(sslResume, 0);
48874893
LOG_ERROR("wolfSSL_connect resume error %d, %s\n", err,
48884894
wolfSSL_ERR_error_string((unsigned long)err, buffer));
48894895
wolfSSL_free(sslResume); sslResume = NULL;

examples/server/server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ int ServerEchoData(WOLFSSL* ssl, int clientfd, int echoData, int block,
487487
ret = wolfSSL_write(ssl, buffer, (int)min((word32)len, (word32)rx_pos)),
488488
ret <= 0);
489489
if (ret != (int)min((word32)len, (word32)rx_pos)) {
490+
err = wolfSSL_get_error(ssl, 0);
490491
LOG_ERROR("SSL_write echo error %d\n", err);
491492
err_sys_ex(runWithErrors, "SSL_write failed");
492493
}

0 commit comments

Comments
 (0)