diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-29 12:04:57 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-29 12:04:57 -0600 |
commit | 6940b244de7c5048c55fc57ada93501c1be5ab20 (patch) | |
tree | 42734faad626d97f45fce0725031896824924701 /libnetio/netio_posix.c | |
parent | 7b34cb7741c683dc623ece652032f1bf09d34140 (diff) |
fixes
Diffstat (limited to 'libnetio/netio_posix.c')
-rw-r--r-- | libnetio/netio_posix.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/libnetio/netio_posix.c b/libnetio/netio_posix.c index 34eac80..34f415d 100644 --- a/libnetio/netio_posix.c +++ b/libnetio/netio_posix.c @@ -10,8 +10,6 @@ #include <sys/socket.h> /* for struct sockaddr, socket(), SOCK_* flags, setsockopt(), SOL_SOCKET, SO_REUSEADDR, bind(), listen(), accept() */ #include <unistd.h> /* for getpid() */ -#include <stdio.h> - #define USE_CONFIG_NETIO_POSIX #include "config.h" @@ -138,11 +136,9 @@ int netio_accept(int sock) { * while waiting for us to accept(). */ for (;;) { #if CONFIG_NETIO_ISLINUX - printf("accept...\n"); cr_sema_wait(&socket_table[sock].accept_waiters); #endif int conn = accept(socket_table[sock].fd, NULL, NULL); - printf("... accept => %d\n", conn); if (conn < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { #if !CONFIG_NETIO_ISLINUX @@ -174,11 +170,8 @@ ssize_t netio_read(int conn, void *buf, size_t count) { if (aio_read(&ctl_block) < 0) return -errno; - while ((r = aio_error(&ctl_block)) == EINPROGRESS) { - printf("read %zu...\n", count); + while ((r = aio_error(&ctl_block)) == EINPROGRESS) cr_pause_and_yield(); - } - printf("...read => n=%zd errno=%d\n", aio_return(&ctl_block), r); return r ? -abs(r) : aio_return(&ctl_block); } @@ -202,11 +195,8 @@ ssize_t netio_write(int conn, void *buf, size_t goal) { if (aio_write(&ctl_block) < 0) return -errno; - while ((r = aio_error(&ctl_block)) == EINPROGRESS) { - printf("write %zu...\n", goal-done); + while ((r = aio_error(&ctl_block)) == EINPROGRESS) cr_pause_and_yield(); - } - printf("...write => n=%zd errno=%d", aio_return(&ctl_block), r); if (r < 0) return -abs(r); done += aio_return(&ctl_block); |