Update sock_check to sock_has_pending

This commit is contained in:
2023-01-02 19:48:57 +01:00
parent 9d8120966d
commit fc9538fa6d
4 changed files with 5 additions and 5 deletions

@ -58,7 +58,7 @@ static int async_exec(evt_listen_t *evt, short r_events) {
int ret, e = errno; int ret, e = errno;
if (r_events & evt->events) { if (r_events & evt->events) {
// specified event(s) occurred // specified event(s) occurred
if (evt->socket && !sock_check(evt->socket)) { if (evt->socket && !sock_has_pending(evt->socket)) {
evt->err_cb(evt->err_arg); evt->err_cb(evt->err_arg);
ret = 0; ret = 0;
} else { } else {

@ -226,7 +226,7 @@ proxy_ctx_t *proxy_init(http_req *req, http_res *res, http_status_ctx *ctx, host
proxy_ctx_t *proxy = proxy_get_by_conf(conf); proxy_ctx_t *proxy = proxy_get_by_conf(conf);
proxy->in_use = 1; proxy->in_use = 1;
if (proxy->initialized && sock_check(&proxy->proxy) == 0) if (proxy->initialized && sock_has_pending(&proxy->proxy) == 0)
goto proxy; goto proxy;
retry: retry:

@ -151,8 +151,8 @@ int sock_close(sock *s) {
return 0; return 0;
} }
int sock_check(sock *s) { int sock_has_pending(sock *s) {
char buf; char buf[1];
int e = errno; int e = errno;
long ret = sock_recv(s, &buf, 1, MSG_PEEK | MSG_DONTWAIT); long ret = sock_recv(s, &buf, 1, MSG_PEEK | MSG_DONTWAIT);
errno = e; errno = e;

@ -46,7 +46,7 @@ long sock_splice_chunked(sock *dst, sock *src, void *buf, unsigned long buf_len)
int sock_close(sock *s); int sock_close(sock *s);
int sock_check(sock *s); int sock_has_pending(sock *s);
int sock_poll(sock *sockets[], sock *ready[], sock *error[], int n_sock, int *n_ready, int *n_error, short events, int timeout_ms); int sock_poll(sock *sockets[], sock *ready[], sock *error[], int n_sock, int *n_ready, int *n_error, short events, int timeout_ms);