summaryrefslogtreecommitdiff
path: root/cmd/srv9p/main.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-27 22:27:01 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-09-27 22:27:01 -0600
commit7ec97df3ee8edfd102fe573eaa61cf4e5c6284cb (patch)
treee696f30da5645cdd3cb09971d9544622e9943bcf /cmd/srv9p/main.c
parentfa357459f88bb8f0170d1a68df66e7d068d59996 (diff)
wip fixes
Diffstat (limited to 'cmd/srv9p/main.c')
-rw-r--r--cmd/srv9p/main.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/cmd/srv9p/main.c b/cmd/srv9p/main.c
index d63c5fb..2c403df 100644
--- a/cmd/srv9p/main.c
+++ b/cmd/srv9p/main.c
@@ -2,16 +2,27 @@
#include <stdio.h>
#include <libcr/coroutine.h>
+#include <libnetio/netio.h>
#include <lib9p/srv.h>
+#define USE_CONFIG_COROUTINE
+#include "config.h"
+
int main() {
int sock = netio_listen(9000);
if (sock < 0)
error(1, -sock, "netio_listen");
- for (int i = 0; i < 8; i++)
- if (!coroutine_add(net9p_cr, &sock))
- error(1, 0, "coroutine_add(net9p_cr, NULL)");
+ struct lib9p_srv srv = {
+ .sockfd = sock,
+ };
+
+ for (int i = 0; i < CONFIG_NETIO_NUM_CONNS; i++)
+ if (!coroutine_add(lib9p_srv_read_cr, &srv))
+ error(1, 0, "coroutine_add(lib9p_srv_read_cr, &srv)");
+ for (int i = 0; i < 2*CONFIG_NETIO_NUM_CONNS; i++)
+ if (!coroutine_add(lib9p_srv_write_cr, &srv))
+ error(1, 0, "coroutine_add(lib9p_srv_write_cr, &srv)");
coroutine_main();
return 1;