diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-02-18 14:28:16 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-02-18 14:28:16 -0700 |
commit | 49db21796512b93c8f1684f23a37eeae61622c0a (patch) | |
tree | 174d8da1e6f62d8ec6568a7a733cbd150d73ac4d | |
parent | e9454b679e02ad06aadf631414716b04bfdf5ed9 (diff) | |
download | liburing-49db21796512b93c8f1684f23a37eeae61622c0a.tar.gz |
examples/proxy: fix confusing mix of -r and -p for proxy vs sink mode
Sink has them reversed which is pretty annoying and ugly. With this
change, -r is always what proxy listens on, regardless of whether
it's acting as a proxy or a sink.
Update the examples as well to reflect that. Only the sink one needed
changing, but lay out the other command lines more logically too so
it's displayed as 'input side' and then 'output side'.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | examples/proxy.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/examples/proxy.c b/examples/proxy.c index 53ad6971..9c671986 100644 --- a/examples/proxy.c +++ b/examples/proxy.c @@ -9,18 +9,18 @@ * Act as a proxy, listening on port 4444, and send data to 192.168.2.6 on port * 4445. Use multishot receive, DEFER_TASKRUN, and fixed files * - * ./proxy -m1 -d1 -f1 -H 192.168.2.6 -r4444 -p4445 + * ./proxy -m1 -d1 -f1 -r4444 -H 192.168.2.6 -p4445 * - * Act as a bi-directional proxy, listening on port 8884, and send data back + * Act as a bi-directional proxy, listening on port 8888, and send data back * and forth between host and 192.168.2.6 on port 22. Use multishot receive, * DEFER_TASKRUN, fixed files, and buffers of size 1500. * - * ./proxy -m1 -d1 -f1 -B1 -b1500 -H 192.168.2.6 -r22 -p8888 + * ./proxy -m1 -d1 -f1 -B1 -b1500 -r8888 -H 192.168.2.6 -p22 * * Act a sink, listening on port 4445, using multishot receive, DEFER_TASKRUN, * and fixed files: * - * ./proxy -m1 -d1 -s1 -f1 -p4445 + * ./proxy -m1 -d1 -s1 -f1 -r4445 * * Run with -h to see a list of options, and their defaults. * @@ -1271,12 +1271,9 @@ int main(int argc, char *argv[]) br_mask = nr_bufs - 1; - if (is_sink) { - fd = setup_listening_socket(send_port); - receive_port = -1; - } else { - fd = setup_listening_socket(receive_port); - } + fd = setup_listening_socket(receive_port); + if (is_sink) + send_port = -1; if (fd == -1) return 1; |