diff options
Diffstat (limited to 'lib9p/tests/test_server/main.c')
-rw-r--r-- | lib9p/tests/test_server/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index 2743629..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)) { @@ -90,7 +92,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 +117,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(); |