X-Git-Url: http://rtime.felk.cvut.cz/gitweb/pes-rpp/rpp-test-sw.git/blobdiff_plain/cd90eccf4c0edc41a514084f1c505f2b95627785..7a2e9fba05bbc93bab0b331d1b46288a7521fc2e:/rpp-test-sw/commands/cmd_echoserver.c diff --git a/rpp-test-sw/commands/cmd_echoserver.c b/rpp-test-sw/commands/cmd_echoserver.c index 054f121..eadbc39 100644 --- a/rpp-test-sw/commands/cmd_echoserver.c +++ b/rpp-test-sw/commands/cmd_echoserver.c @@ -117,7 +117,7 @@ static void es_thread_terminate(struct es_thread_context *thread_context) } -static void es_logic(void *data) +static void es_logic(cmd_io_t *cmd_io, void *data) { struct es_thread_context *thread_context = (struct es_thread_context*)data; err_t err = ERR_OK; @@ -140,7 +140,7 @@ static void es_logic(void *data) goto leave_clean; } - while (1) { /* keep-alive */ + while (cmd_io == NULL || cmd_io->getc(cmd_io) < 0) { /* keep-alive */ err = netconn_accept(thread_context->conn_listen, &thread_context->conn); if (err == ERR_OK) { struct netbuf *netbuf; @@ -192,7 +192,7 @@ static void es_thread(void *data) struct es_thread_context *thread_context = (struct es_thread_context*)data; /* Run the echoserver logic */ - es_logic(data); + es_logic(NULL, data); /* It is mandatory to destroy the thread when leaving; * Be aware of the fact that we are terminating ourselves -- @@ -291,7 +291,7 @@ int cmd_do_init_es(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) } else if (command == ES_COMMAND_RUN_FOREGROUND) { /* Run in the foreground */ - es_logic((void *)thread_context); + es_logic(cmd_io, (void *)thread_context); } else if (command == ES_COMMAND_LIST_THREADS) { for (i = 0; i < MAX_THREADS_CNT; i++) { if (es_threads[i].status == ES_THREAD_RUNNING) {