}
-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;
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;
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 --
} 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) {