diff options
-rw-r--r-- | autistdraw.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/autistdraw.c b/autistdraw.c index d3215bf..b38eade 100644 --- a/autistdraw.c +++ b/autistdraw.c @@ -112,6 +112,8 @@ struct app_context struct msg_reader msg_reader; ///< Server message reader write_queue_t write_queue; ///< Server write queue + bool no_wait; ///< Don't wait for server confirmations + // Server: int listen_fd; ///< Listening FD ev_io listen_watcher; ///< Listening FD watcher @@ -514,12 +516,14 @@ draw_point_internal (app_context_t *app, int x, int y, uint8_t color) static void draw_point (app_context_t *app, int x, int y, uint8_t color) { - // We don't actually draw anything immediately in client mode, - // instead we wait for confirmation from the server if (app->mode == NETWORK_MODE_CLIENT) { send_draw_point_request (app, x, y, color); - return; + + // We don't usually draw anything immediately in client mode, + // instead we wait for confirmation from the server + if (!app->no_wait) + return; } draw_point_internal (app, x, y, color); @@ -1372,6 +1376,7 @@ struct app_options { struct addrinfo *client_address; ///< Address to connect to struct addrinfo *server_address; ///< Address to listen at + bool no_wait; ///< Don't wait for server confirmations }; static void @@ -1439,6 +1444,8 @@ parse_program_arguments (app_options_t *options, int argc, char **argv) { 'V', "version", NULL, 0, "output version information and exit" }, { 's', "server", "[ADDRESS]:PORT", 0, "start a server" }, { 'c', "client", "[ADDRESS]:PORT", 0, "connect to a server" }, + { 'n', "no-wait", NULL, OPT_LONG_ONLY, + "don't wait for server confirmations" }, { 0, NULL, NULL, 0, NULL } }; @@ -1476,6 +1483,9 @@ parse_program_arguments (app_options_t *options, int argc, char **argv) if (!(options->client_address = parse_address (optarg, 0))) exit (EXIT_FAILURE); break; + case 'n': + options->no_wait = true; + break; default: fprintf (stderr, "%s: %s\n", "error", "wrong options"); opt_handler_usage (&oh, stderr); @@ -1617,6 +1627,7 @@ main (int argc, char *argv[]) else app.mode = NETWORK_MODE_STANDALONE; + app.no_wait = options.no_wait; app_options_free (&options); termo_t *tk = termo_new (STDIN_FILENO, NULL, 0); |