mirror of
https://github.com/curl/curl.git
synced 2026-05-30 03:37:28 +03:00
wolfssl: simplify wssl_send_earlydata
Move out logic from a switch() expression and return error directly instead of using goto. This also removes the odd-looking two subsequent closing braces at the same indent level. Closes #19509
This commit is contained in:
parent
cb2bcb681f
commit
833c429627
1 changed files with 7 additions and 15 deletions
|
|
@ -1618,7 +1618,6 @@ static CURLcode wssl_send_earlydata(struct Curl_cfilter *cf,
|
|||
{
|
||||
struct ssl_connect_data *connssl = cf->ctx;
|
||||
struct wssl_ctx *wssl = (struct wssl_ctx *)connssl->backend;
|
||||
CURLcode result = CURLE_OK;
|
||||
const unsigned char *buf;
|
||||
size_t blen;
|
||||
|
||||
|
|
@ -1633,23 +1632,17 @@ static CURLcode wssl_send_earlydata(struct Curl_cfilter *cf,
|
|||
blen, rc, nwritten);
|
||||
if(rc < 0) {
|
||||
int err = wolfSSL_get_error(wssl->ssl, rc);
|
||||
char error_buffer[256];
|
||||
switch(err) {
|
||||
case WOLFSSL_ERROR_NONE: /* just did not get anything */
|
||||
case WOLFSSL_ERROR_WANT_READ:
|
||||
case WOLFSSL_ERROR_WANT_WRITE:
|
||||
result = CURLE_AGAIN;
|
||||
break;
|
||||
default: {
|
||||
char error_buffer[256];
|
||||
CURL_TRC_CF(data, cf, "SSL send early data, error: '%s'(%d)",
|
||||
wssl_strerror((unsigned long)err, error_buffer,
|
||||
sizeof(error_buffer)),
|
||||
err);
|
||||
result = CURLE_SEND_ERROR;
|
||||
break;
|
||||
return CURLE_AGAIN;
|
||||
}
|
||||
}
|
||||
goto out;
|
||||
CURL_TRC_CF(data, cf, "SSL send early data, error: '%s'(%d)",
|
||||
wssl_strerror((unsigned long)err, error_buffer,
|
||||
sizeof(error_buffer)), err);
|
||||
return CURLE_SEND_ERROR;
|
||||
}
|
||||
|
||||
Curl_bufq_skip(&connssl->earlydata, (size_t)nwritten);
|
||||
|
|
@ -1659,8 +1652,7 @@ static CURLcode wssl_send_earlydata(struct Curl_cfilter *cf,
|
|||
if(!Curl_ssl_cf_is_proxy(cf))
|
||||
Curl_pgrsEarlyData(data, (curl_off_t)connssl->earlydata_skip);
|
||||
infof(data, "SSL sending %zu bytes of early data", connssl->earlydata_skip);
|
||||
out:
|
||||
return result;
|
||||
return CURLE_OK;
|
||||
}
|
||||
#endif /* WOLFSSL_EARLY_DATA */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue