Skip to content

Commit c26a398

Browse files
committed
s/CONN_ASYNC_AWAIT_MULTIPLE/CONN_ASYNC_AWAITV/g
Makes this more consistent with the API names I ended up using.
1 parent 92b4ec7 commit c26a398

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/lib/lwan-thread.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -620,9 +620,9 @@ static void unasync_await_conn(void *data1, void *data2)
620620
struct lwan_connection *async_fd_conn = data1;
621621

622622
async_fd_conn->flags &=
623-
~(CONN_ASYNC_AWAIT | CONN_HUNG_UP | CONN_ASYNC_AWAIT_MULTIPLE);
623+
~(CONN_ASYNC_AWAIT | CONN_HUNG_UP | CONN_ASYNC_AWAITV);
624624
assert(async_fd_conn->parent);
625-
async_fd_conn->parent->flags &= ~CONN_ASYNC_AWAIT_MULTIPLE;
625+
async_fd_conn->parent->flags &= ~CONN_ASYNC_AWAITV;
626626

627627
async_fd_conn->thread = data2;
628628

@@ -705,8 +705,8 @@ struct flag_update {
705705
enum lwan_connection_coro_yield request_conn_yield;
706706
};
707707

708-
static void reset_conn_async_await_multiple_flag(struct lwan_connection *conns,
709-
va_list ap_orig)
708+
static void reset_conn_async_awaitv_flag(struct lwan_connection *conns,
709+
va_list ap_orig)
710710
{
711711
va_list ap;
712712

@@ -719,7 +719,7 @@ static void reset_conn_async_await_multiple_flag(struct lwan_connection *conns,
719719
break;
720720
}
721721

722-
conns[await_fd].flags &= ~CONN_ASYNC_AWAIT_MULTIPLE;
722+
conns[await_fd].flags &= ~CONN_ASYNC_AWAITV;
723723

724724
LWAN_NO_DISCARD(va_arg(ap, enum lwan_connection_coro_yield));
725725
}
@@ -732,7 +732,7 @@ update_flags_for_async_awaitv(struct lwan_request *r, struct lwan *l, va_list ap
732732
struct flag_update update = {.num_awaiting = 0,
733733
.request_conn_yield = CONN_CORO_YIELD};
734734

735-
reset_conn_async_await_multiple_flag(l->conns, ap);
735+
reset_conn_async_awaitv_flag(l->conns, ap);
736736

737737
while (true) {
738738
int await_fd = va_arg(ap, int);
@@ -751,13 +751,13 @@ update_flags_for_async_awaitv(struct lwan_request *r, struct lwan *l, va_list ap
751751

752752
struct lwan_connection *conn = &l->conns[await_fd];
753753

754-
if (UNLIKELY(conn->flags & CONN_ASYNC_AWAIT_MULTIPLE)) {
754+
if (UNLIKELY(conn->flags & CONN_ASYNC_AWAITV)) {
755755
lwan_status_debug("ignoring second awaitv call on same fd: %d",
756756
await_fd);
757757
continue;
758758
}
759759

760-
conn->flags |= CONN_ASYNC_AWAIT_MULTIPLE;
760+
conn->flags |= CONN_ASYNC_AWAITV;
761761
update.num_awaiting++;
762762

763763
if (await_fd == r->fd) {
@@ -793,7 +793,7 @@ int lwan_request_awaitv_any(struct lwan_request *r, ...)
793793
int64_t v = coro_yield(r->conn->coro, update.request_conn_yield);
794794
struct lwan_connection *conn = (struct lwan_connection *)(uintptr_t)v;
795795

796-
if (conn->flags & CONN_ASYNC_AWAIT_MULTIPLE)
796+
if (conn->flags & CONN_ASYNC_AWAITV)
797797
return lwan_connection_get_fd(l, conn);
798798
}
799799
}
@@ -811,8 +811,8 @@ void lwan_request_awaitv_all(struct lwan_request *r, ...)
811811
int64_t v = coro_yield(r->conn->coro, update.request_conn_yield);
812812
struct lwan_connection *conn = (struct lwan_connection *)(uintptr_t)v;
813813

814-
if (conn->flags & CONN_ASYNC_AWAIT_MULTIPLE) {
815-
conn->flags &= ~CONN_ASYNC_AWAIT_MULTIPLE;
814+
if (conn->flags & CONN_ASYNC_AWAITV) {
815+
conn->flags &= ~CONN_ASYNC_AWAITV;
816816
update.num_awaiting--;
817817
}
818818
}

src/lib/lwan.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -286,24 +286,24 @@ enum lwan_connection_flags {
286286
* whenever associated client connection is closed. */
287287
CONN_ASYNC_AWAIT = 1 << 8,
288288

289-
CONN_SENT_CONNECTION_HEADER = 1 << 9,
289+
/* Used to both implement lwan_request_awaitv_all() correctly, and to
290+
* ensure that spurious resumes from fds that weren't in the multiple
291+
* await call won't return to the request handler. */
292+
CONN_ASYNC_AWAITV = 1 << 9,
293+
294+
CONN_SENT_CONNECTION_HEADER = 1 << 10,
290295

291296
/* Is this a TLS connection? */
292-
CONN_TLS = 1 << 10,
297+
CONN_TLS = 1 << 11,
293298

294299
/* Both are used to know if an epoll event pertains to a listener rather
295300
* than a client. */
296-
CONN_LISTENER = 1 << 11,
301+
CONN_LISTENER = 1 << 12,
297302

298303
/* Only valid when CONN_ASYNC_AWAIT is set. Set on file descriptors that
299304
* got (EPOLLHUP|EPOLLRDHUP) events from epoll so that request handlers
300305
* can deal with this fact. */
301-
CONN_HUNG_UP = 1 << 12,
302-
303-
/* Used to both implement lwan_request_awaitv_all() correctly, and to
304-
* ensure that spurious resumes from fds that weren't in the multiple
305-
* await call won't return to the request handler. */
306-
CONN_ASYNC_AWAIT_MULTIPLE = 1 << 13,
306+
CONN_HUNG_UP = 1 << 13,
307307

308308
CONN_FLAG_LAST = CONN_HUNG_UP,
309309
};

0 commit comments

Comments
 (0)