X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fio.c;h=8e7f9e9a2716fd632c55df8e6ec0e92083140b36;hb=d361b21fb63d9e1fd2ff7774c2322fab3e4eb239;hp=28c76b8f558754b5c377cd71ccd816a357e242c0;hpb=cc4ed0c49279f08a053a3e3a9a4acba22283a01f;p=plomrogue diff --git a/src/server/io.c b/src/server/io.c index 28c76b8..8e7f9e9 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -1,5 +1,6 @@ /* src/server/io.c */ +#define _BSD_SOURCE /* usleep() */ #include "io.h" #include /* global errno */ #include /* PIPE_BUF */ @@ -10,7 +11,7 @@ #include /* strlen(), memcpy() */ #include /* time_t */ #include /* time() */ -#include "../common/err_try_fgets.h" /* err_line() */ +#include /* usleep() */ #include "../common/readwrite.h" /* try_fopen(), try_fclose_unlink_rename(), * try_fwrite(), try_fputc(), try_fgetc() */ @@ -28,8 +29,8 @@ */ static char * get_message_from_queue(); -/* Read input file for input into world.queue. new queue input. Wait a few - * seconds until giving up. Translate '\n' chars in input file into '\0' chars. +/* Poll input file for world.queue input. Wait a few seconds until giving up; + * poll only every 0.03 seconds.. Translate '\n' chars in input file into '\0'. */ static void read_file_into_queue(); @@ -94,6 +95,7 @@ static void read_file_into_queue() int test; while (EOF == (test = try_fgetc(world.file_in, f_name))) { + usleep(33); if (time(0) > now + wait_seconds) { return;