aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/msg.c8
-rw-r--r--src/msg.h2
-rw-r--r--src/server.c4
3 files changed, 11 insertions, 3 deletions
diff --git a/src/msg.c b/src/msg.c
index ba6c474..b87052c 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -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;
+}
diff --git a/src/msg.h b/src/msg.h
index 028aaa0..fca230e 100644
--- a/src/msg.h
+++ b/src/msg.h
@@ -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 *)