From dcc5330eefd12028b64acb03c832f5ff4764b7a8 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Fri, 10 May 2024 21:54:45 +0200 Subject: PKT_BUF and PLD_BUF macros fixed --- ecp/server/Makefile | 2 +- ecp/server/dir.c | 4 ++-- ecp/server/dir.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ecp/server') diff --git a/ecp/server/Makefile b/ecp/server/Makefile index 1ac945d..977e891 100644 --- a/ecp/server/Makefile +++ b/ecp/server/Makefile @@ -3,7 +3,7 @@ include $(src_dir)/ecp/common.mk CFLAGS += -I../util -Wno-int-to-void-pointer-cast LDFLAGS += -lrt -obj = server.o dir.o vlink.o ht.o acl.o sig.o # timer.o +obj = server.o dir.o vlink.o ht.o acl.o sig.o timer.o dep = ../build-posix/*.a ../util/libecputil.a %.o: %.c diff --git a/ecp/server/dir.c b/ecp/server/dir.c index 738c787..03474df 100644 --- a/ecp/server/dir.c +++ b/ecp/server/dir.c @@ -112,8 +112,8 @@ ssize_t dir_handle_client_msg(struct ECPConnection *conn, ecp_seq_t seq, unsigne ssize_t dir_send_ann(ECPConnection *conn) { ECPBuffer packet; ECPBuffer payload; - unsigned char pkt_buf[ECP_SIZE_PKT_BUF(2, MTYPE_DIR_ANN, conn)]; - unsigned char pld_buf[ECP_SIZE_PLD_BUF(2, MTYPE_DIR_ANN, conn)]; + unsigned char pkt_buf[ECP_SIZE_PKT_BUF(ECP_SIZE_PLD(2, MTYPE_DIR_ANN), conn)]; + unsigned char pld_buf[ECP_SIZE_PLD_BUF(ECP_SIZE_PLD(2, MTYPE_DIR_ANN), conn)]; unsigned char *msg; packet.buffer = pkt_buf; diff --git a/ecp/server/dir.h b/ecp/server/dir.h index 0871c33..022010a 100644 --- a/ecp/server/dir.h +++ b/ecp/server/dir.h @@ -1,4 +1,4 @@ -#define MAX_DIR_ITEM_IN_MSG ((ECP_MAX_PLD - ECP_SIZE_PLD(0, ECP_MTYPE_DIR_REP) - (2 + sizeof(uint16_t))) / ECP_SIZE_DIR_ITEM) +#define MAX_DIR_ITEM_IN_MSG ((ECP_MAX_PLD - ECP_SIZE_PLD((2 + sizeof(uint16_t)), ECP_MTYPE_DIR_REP)) / ECP_SIZE_DIR_ITEM) #define MAX_DIR_MSG 10 #define MAX_DIR_ITEM (MAX_DIR_MSG * MAX_DIR_ITEM_IN_MSG) -- cgit v1.2.3