mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 09:40:51 +02:00
Minor error handling fixes in client and server examples
This commit is contained in:
@@ -849,6 +849,7 @@ static int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port,
|
||||
WOLFSSL_ASYNC_WHILE_PENDING(ret = wolfSSL_write(ssl, tx_buffer, len),
|
||||
ret <= 0);
|
||||
if (ret != len) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
LOG_ERROR("SSL_write bench error %d!\n", err);
|
||||
if (!exitWithRet)
|
||||
err_sys("SSL_write failed");
|
||||
@@ -912,7 +913,11 @@ doExit:
|
||||
XFREE(rx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
}
|
||||
else {
|
||||
err_sys("wolfSSL_connect failed");
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
LOG_ERROR("wolfSSL_connect error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, NULL));
|
||||
if (!exitWithRet)
|
||||
err_sys("wolfSSL_connect failed");
|
||||
}
|
||||
|
||||
wolfSSL_shutdown(ssl);
|
||||
@@ -4884,6 +4889,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
ret = NonBlockingSSL_Connect(sslResume); /* will keep retrying on timeout */
|
||||
#endif
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
err = wolfSSL_get_error(sslResume, 0);
|
||||
LOG_ERROR("wolfSSL_connect resume error %d, %s\n", err,
|
||||
wolfSSL_ERR_error_string((unsigned long)err, buffer));
|
||||
wolfSSL_free(sslResume); sslResume = NULL;
|
||||
|
||||
@@ -487,6 +487,7 @@ int ServerEchoData(WOLFSSL* ssl, int clientfd, int echoData, int block,
|
||||
ret = wolfSSL_write(ssl, buffer, (int)min((word32)len, (word32)rx_pos)),
|
||||
ret <= 0);
|
||||
if (ret != (int)min((word32)len, (word32)rx_pos)) {
|
||||
err = wolfSSL_get_error(ssl, 0);
|
||||
LOG_ERROR("SSL_write echo error %d\n", err);
|
||||
err_sys_ex(runWithErrors, "SSL_write failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user