From c56cc12c154b3f21411d71e10f4e8a5a9682355b Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Thu, 28 May 2026 00:09:50 +0530 Subject: the moves now make it to the frontend i know the issue which exists, where the server can't handle the request if i reload the page --- src/ipc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ipc.c') diff --git a/src/ipc.c b/src/ipc.c index efdb8ce..a55e22e 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -21,8 +21,19 @@ char* read_queue(mqd_t target) { return buf; } -void send_queue(mqd_t target, const char* msg) { - mq_send(target, msg, sizeof(msg), 0); +void send_queue(mqd_t target, const char* msg, int n) { + mq_send(target, msg, n, 0); +} + +int get_num_messages(mqd_t target) { + struct mq_attr target_attr; + + if (mq_getattr(target, &target_attr) == -1) { + perror("mq_getattr"); + exit(1); + } + + return target_attr.mq_curmsgs; } #endif // IPC_C -- cgit v1.2.3