From cab382db088d9f240253466a1c5a26c62f3967c8 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Sat, 8 Feb 2025 22:13:52 +0300 Subject: Implemented multiplexing in main thread (TCP loop). Removed CMake files. TODO: Implement multiplexing in worker threads (UDP loops), implement channel_pool interface. --- include/packet.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'include/packet.c') diff --git a/include/packet.c b/include/packet.c index a523285..45ebcd1 100644 --- a/include/packet.c +++ b/include/packet.c @@ -1,14 +1,17 @@ #include "packet.h" -i64 const commd_size_lookup[64] = {[CMD_CREATE] = sizeof(struct commd_create), - [CMD_DELETE] = sizeof(struct commd_delete), - [CMD_JOIN] = sizeof(struct commd_join), - [CMD_LEAVE] = sizeof(struct commd_leave), - [CMD_REGISTER] = sizeof(struct commd_register), - [CMD_UNREGISTER] = sizeof(struct commd_unregister), - [CMD_GET_PORT] = sizeof(struct commd_get_port), - [CMD_GET_CHANNELS] = 0, // You can not get a sizeof(void) - 0}; +i64 const commd_size_lookup[64] = { + [CMD_CREATE] = sizeof(struct commd_create), + [CMD_DELETE] = sizeof(struct commd_delete), + [CMD_JOIN] = sizeof(struct commd_join), + [CMD_LEAVE] = sizeof(struct commd_leave), + [CMD_REGISTER] = sizeof(struct commd_register), + [CMD_UNREGISTER] = sizeof(struct commd_unregister), + [CMD_GET_PORT] = sizeof(struct commd_get_port), + [CMD_GET_CHANNELS] = 0, // You can not get a sizeof(void) + [CMD_LAST] = -1, + 0 +}; u32 system_packet_checksum(struct kv_system_packet *packet) { @@ -61,6 +64,9 @@ const char *kv_strerror(enum commd_error e) return "Not implemented"; case ERR_DO_IT_YOURSELF: return "You should not have recieved this error. This is either server or network fault"; + case ERR_TYPE: + return "No such command"; } return "Unknown error"; } +/* vim: set ts=8 noet: */ -- cgit v1.2.3-70-g09d2