diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-02-16 21:54:13 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-16 21:54:13 -0700 |
commit | 8bfa467fbe99901e365c2769b99aee8a3dd4713f (patch) | |
tree | 15fb36348bbf2c13a5d7990b0a296d1617d71ceb | |
parent | d3b29965166e304dafa18b6457a88db8cb139823 (diff) | |
download | liburing-8bfa467fbe99901e365c2769b99aee8a3dd4713f.tar.gz |
examples/proxy: simplify bidi mode
We don't need two receive states that do the same thing, just use
the normal RECV for the normal input part for bidi.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | examples/proxy.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/examples/proxy.c b/examples/proxy.c index b58c43ec..3455e2d9 100644 --- a/examples/proxy.c +++ b/examples/proxy.c @@ -53,9 +53,8 @@ #define __SOCK 2ULL #define __CONNECT 3ULL #define __RECV 4ULL -#define __RECV_IN 5ULL -#define __RECV_OUT 6ULL -#define __SEND 7ULL +#define __RECV_OUT 5ULL +#define __SEND 6ULL /* * Goes from accept new connection -> create socket, connect to end @@ -65,7 +64,6 @@ #define SOCK_DATA (__SOCK << OP_SHIFT) #define CONNECT_DATA (__CONNECT << OP_SHIFT) #define RECV_DATA (__RECV << OP_SHIFT) -#define RECV_IN_DATA (__RECV_IN << OP_SHIFT) #define RECV_OUT_DATA (__RECV_OUT << OP_SHIFT) #define SEND_DATA (__SEND << OP_SHIFT) @@ -286,7 +284,7 @@ static void submit_receive(struct io_uring *ring, struct conn *c) static void submit_bidi_receive(struct io_uring *ring, struct conn *c) { - __submit_receive(ring, c, c->in_fd, RECV_IN_DATA); + __submit_receive(ring, c, c->in_fd, RECV_DATA); __submit_receive(ring, c, c->out_fd, RECV_OUT_DATA); } @@ -478,10 +476,6 @@ static int handle_cqe(struct io_uring *ring, struct io_uring_cqe *cqe) handle_receive(ring, c, cqe, &need_submit, c->in_fd, c->out_fd, RECV_DATA); break; } - case __RECV_IN: { - handle_receive(ring, c, cqe, &need_submit, c->in_fd, c->out_fd, RECV_IN_DATA); - break; - } case __RECV_OUT: { handle_receive(ring, c, cqe, &need_submit, c->out_fd, c->in_fd, RECV_OUT_DATA); break; |