From 7741ed43f5bc0be9473a281d050c6fbdbc6aea81 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 6 Apr 2025 03:28:09 -0600 Subject: lib9p: Rename the server coroutine functions, pull out the read func --- lib9p/tests/test_server/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib9p/tests/test_server/main.c') diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index 2743629..b543892 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -90,7 +90,15 @@ static COROUTINE read_cr(void *_i) { hostnet_tcp_listener_init(&globals.listeners[i], globals.port); - lib9p_srv_read_cr(&globals.srv, lo_box_hostnet_tcplist_as_net_stream_listener(&globals.listeners[i])); + lib9p_srv_accept_and_read_loop(&globals.srv, lo_box_hostnet_tcplist_as_net_stream_listener(&globals.listeners[i])); + + cr_end(); +} + +static COROUTINE write_cr(void *) { + cr_begin(); + + lib9p_srv_worker_loop(&globals.srv); cr_end(); } @@ -107,8 +115,8 @@ static COROUTINE init_cr(void *) { } for (int i = 0; i < 2*CONFIG_SRV9P_NUM_CONNS; i++) { char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'}; - if (!coroutine_add(name, lib9p_srv_write_cr, &globals.srv)) - error(1, 0, "coroutine_add(lib9p_srv_write_cr, &globals.srv)"); + if (!coroutine_add(name, write_cr, NULL)) + error(1, 0, "coroutine_add(write_cr, NULL)"); } cr_exit(); -- cgit v1.2.3-2-g168b From bf32c2cd495099c93195b202158f46870ceed0ef Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 12 Apr 2025 06:37:54 -0600 Subject: lib9p: Test+fix that auth data is tracked in the context --- lib9p/tests/test_server/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib9p/tests/test_server/main.c') diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index b543892..e89a75e 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -21,6 +21,7 @@ #include "static.h" #include "fs_shutdown.h" #include "fs_slowread.h" +#include "fs_whoami.h" /* configuration **************************************************************/ @@ -76,6 +77,7 @@ struct lib9p_srv_file root = .flushable = false), API_FILE(7, "slowread-flushable", slowread, .flushable = true), + API_FILE(8, "whoami", whoami), ); static lo_interface lib9p_srv_file get_root(struct lib9p_srv_ctx *LM_UNUSED(ctx), struct lib9p_s LM_UNUSED(treename)) { -- cgit v1.2.3-2-g168b