diff options
-rw-r--r-- | src/msg.c | 8 | ||||
-rw-r--r-- | src/msg.h | 2 | ||||
-rw-r--r-- | src/server.c | 4 |
3 files changed, 11 insertions, 3 deletions
@@ -190,3 +190,11 @@ void msg_free(const struct msg *msg) free(msg->argv[i]); free(msg->argv); } + +int msg_dump_unknown(const struct msg *msg) +{ + print_log("Received an unknown message:\n"); + for (int i = 0; i < msg->argc; ++i) + print_log("\t%s\n", msg->argv[i]); + return -1; +} @@ -18,4 +18,6 @@ int msg_recv_and_send_result(int fd, msg_handler, void *arg); void msg_free(const struct msg *); +int msg_dump_unknown(const struct msg *); + #endif diff --git a/src/server.c b/src/server.c index 035adbe..9604bd6 100644 --- a/src/server.c +++ b/src/server.c @@ -21,9 +21,7 @@ void server_destroy(const struct server *server) static int msg_handle(const struct msg *msg, void *) { - for (int i = 0; i < msg->argc; ++i) - printf("msg[%d]: %s\n", i, msg->argv[i]); - return 0; + return msg_dump_unknown(msg); } static int server_handle(int fd, void *) |