curl/lib/vquic
Viktor Szakats 879a1514c3
socket: introduce SOCK_EAGAIN() and use it
To contain the logic of checking for both `EWOULDBLOCK` and/or `EAGAIN`
depending on platform/availability. Also to avoid checking for both if
they mapp to the same value, and to avoid PP guards around use.

This also ensures `EAGAIN` is consistently not checked on Windows, where
headers defined it, but `SOCKERRNO` never returns it, because curl maps
it to `WSAGetLastError()`.

If they map to the same value, checking them both in an `if` expression
trips GCC warning `-Wlogical-op` (the same way it triggers duplicate
case value error in `switch`).

Also:
- replace two `switch()` statements with the new macro.
- tests/server/sws: make two outliers use the new macro that were only
  checking for `EWOULDBLOCK` before this patch, in `connect_to()`.
- move variables to the left-side of expressions, where missing.
- rustls: use a variant of this macro that uses raw `EWOULDBLOCK`.
  Tried tracing it back to the origins, but I couldn't figure out if
  this is working as expected on all supported Windows versions in
  Rust. It seems to be using `GetLastError()`, according to
  https://docs.rs/system_error/0.2.0/system_error/, which would be
  probably incorrect.

Notes:
- it's probably a good idea to assign `SOCKERRNO` to a variable before
  passing it to this macro.

Cherry-picked from #21893

Closes #21992
2026-06-12 23:27:23 +02:00
..
capsule.c vquic: moving related things into subdir 2026-06-02 22:48:21 +02:00
capsule.h vquic: moving related things into subdir 2026-06-02 22:48:21 +02:00
cf-capsule.c tidy-up: miscellaneous 2026-06-05 16:57:38 +02:00
cf-capsule.h vquic: moving related things into subdir 2026-06-02 22:48:21 +02:00
cf-ngtcp2-cmn.c cf-socket: make Curl_addr2string static 2026-06-11 08:15:31 +02:00
cf-ngtcp2-cmn.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
cf-ngtcp2-proxy.c tidy-up: miscellaneous 2026-06-11 19:48:07 +02:00
cf-ngtcp2-proxy.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
cf-ngtcp2.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
cf-ngtcp2.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
cf-quiche.c cf-socket: make Curl_addr2string static 2026-06-11 08:15:31 +02:00
cf-quiche.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vquic-tls.c ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vquic-tls.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vquic.c socket: introduce SOCK_EAGAIN() and use it 2026-06-12 23:27:23 +02:00
vquic.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vquic_int.h clang-tidy: add more missing parentheses in macro values 2026-02-25 15:43:23 +01:00