mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:53:32 +03:00
add RAW macro for rustls and use it
comparing to raw EWOULDBLOCK may not be working as expected on Windows. Based on this: https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error Rust doesn't seem to be returning the socket error on Windows, but a GetLastError() which does not return EWOULDBLOCK or SOCKEWOULDBLOCK.
This commit is contained in:
parent
14cd3ff22b
commit
6e4aa6600a
2 changed files with 4 additions and 10 deletions
|
|
@ -1139,8 +1139,10 @@ typedef unsigned int curl_bit;
|
|||
|
||||
#if EAGAIN != SOCKEWOULDBLOCK
|
||||
#define SOCK_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN || (e) == SOCKEWOULDBLOCK)
|
||||
#define RAW_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN || (e) == EWOULDBLOCK)
|
||||
#else
|
||||
#define SOCK_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN)
|
||||
#define RAW_EAGAIN_EWOULDBLOCK(e) ((e) == EAGAIN)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -160,11 +160,7 @@ static ssize_t tls_recv_more(struct Curl_cfilter *cf,
|
|||
io_ctx.data = data;
|
||||
io_error = rustls_connection_read_tls(backend->conn, read_cb, &io_ctx,
|
||||
&tls_bytes_read);
|
||||
if(io_error == EWOULDBLOCK
|
||||
#if EAGAIN != EWOULDBLOCK
|
||||
|| io_error == EAGAIN
|
||||
#endif
|
||||
) {
|
||||
if(RAW_EAGAIN_EWOULDBLOCK(io_error)) {
|
||||
*err = CURLE_AGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -274,11 +270,7 @@ static CURLcode cr_flush_out(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
while(rustls_connection_wants_write(rconn)) {
|
||||
io_error = rustls_connection_write_tls(rconn, write_cb, &io_ctx,
|
||||
&tlswritten);
|
||||
if(io_error == EWOULDBLOCK
|
||||
#if EAGAIN != EWOULDBLOCK
|
||||
|| io_error == EAGAIN
|
||||
#endif
|
||||
) {
|
||||
if(RAW_EAGAIN_EWOULDBLOCK(io_error)) {
|
||||
CURL_TRC_CF(data, cf, "cf_send: EAGAIN after %zu bytes",
|
||||
tlswritten_total);
|
||||
return CURLE_AGAIN;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue