mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
Apply clangformat
This commit is contained in:
parent
63d6e9b91b
commit
bb00a23116
1 changed files with 5 additions and 10 deletions
15
httplib.h
15
httplib.h
|
@ -2315,7 +2315,8 @@ inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Error wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec) {
|
inline Error wait_until_socket_is_ready(socket_t sock, time_t sec,
|
||||||
|
time_t usec) {
|
||||||
#ifdef CPPHTTPLIB_USE_POLL
|
#ifdef CPPHTTPLIB_USE_POLL
|
||||||
struct pollfd pfd_read;
|
struct pollfd pfd_read;
|
||||||
pfd_read.fd = sock;
|
pfd_read.fd = sock;
|
||||||
|
@ -2325,9 +2326,7 @@ inline Error wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec)
|
||||||
|
|
||||||
auto poll_res = handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); });
|
auto poll_res = handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); });
|
||||||
|
|
||||||
if (poll_res == 0) {
|
if (poll_res == 0) { return Error::ConnectionTimeout; }
|
||||||
return Error::ConnectionTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (poll_res > 0 && pfd_read.revents & (POLLIN | POLLOUT)) {
|
if (poll_res > 0 && pfd_read.revents & (POLLIN | POLLOUT)) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
@ -2359,9 +2358,7 @@ inline Error wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec)
|
||||||
return select(static_cast<int>(sock + 1), &fdsr, &fdsw, &fdse, &tv);
|
return select(static_cast<int>(sock + 1), &fdsr, &fdsw, &fdse, &tv);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) { return Error::ConnectionTimeout; }
|
||||||
return Error::ConnectionTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret > 0 && (FD_ISSET(sock, &fdsr) || FD_ISSET(sock, &fdsw))) {
|
if (ret > 0 && (FD_ISSET(sock, &fdsr) || FD_ISSET(sock, &fdsw))) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
@ -2703,9 +2700,7 @@ inline socket_t create_client_socket(
|
||||||
}
|
}
|
||||||
error = wait_until_socket_is_ready(sock2, connection_timeout_sec,
|
error = wait_until_socket_is_ready(sock2, connection_timeout_sec,
|
||||||
connection_timeout_usec);
|
connection_timeout_usec);
|
||||||
if (error != Error::Success) {
|
if (error != Error::Success) { return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_nonblocking(sock2, false);
|
set_nonblocking(sock2, false);
|
||||||
|
|
Loading…
Reference in a new issue