From 39f3538f7ee56dab414d62201235f8427b4a9592 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 24 Nov 2020 12:15:01 +0100 Subject: Added userspace-based network timeout The network in my whole city is down right now, so I've done some error catching using timeouts etc without the kernel blocking everything. Not having internet is exhausting though :( --- apps/server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apps/server.c') diff --git a/apps/server.c b/apps/server.c index 4ab3369..6aca617 100644 --- a/apps/server.c +++ b/apps/server.c @@ -21,7 +21,8 @@ int main() socket->state = S_CONNECTED; char buf[4096] = { 0 }; - net_receive(socket, buf, 4096); + if (!net_receive(socket, buf, 4096, NET_NO_TIMEOUT)) + break; char path[128] = { 0 }; strcat(path, PATH); @@ -41,5 +42,7 @@ int main() net_close(socket); } - return 0; + print("Server closed!\n"); + + return 1; } -- cgit v1.2.3