diff options
Diffstat (limited to 'ecp/server')
-rw-r--r-- | ecp/server/dir.c | 14 | ||||
-rw-r--r-- | ecp/server/dir.h | 6 |
2 files changed, 9 insertions, 11 deletions
diff --git a/ecp/server/dir.c b/ecp/server/dir.c index 149d14d..91d364f 100644 --- a/ecp/server/dir.c +++ b/ecp/server/dir.c @@ -182,10 +182,10 @@ ssize_t dir_send_shadow(ECPConnection *conn) { pthread_mutex_lock(&node->mutex); if (node->verified || node->ann_local) { - if (count < MAX_DIR_ITEM_IN_MSG) { + if (count < ECP_MAX_DIR_ITEM_IN_MSG) { size_t rv_ser; - rv_ser = ecp_dir_item_serialize(&node->dir_item, _msg); + rv_ser = ecp_dir_serialize_item(&node->dir_item, _msg); _msg += rv_ser; _msg_size += rv_ser; count++; @@ -332,7 +332,7 @@ ssize_t dir_handle_shadow(ECPConnection *conn, unsigned char *msg, size_t msg_si ECPDirItem dir_item; size_t rv; - rv = ecp_dir_item_parse(&dir_item, msg); + rv = ecp_dir_parse_item(&dir_item, msg); msg += rv; if (dir_item.region >= MAX_REGION) { @@ -606,11 +606,11 @@ void dir_online_switch(ECPSocket *sock, int inc_serial) { if (dir_online) { size_t rv_ser; - rv_ser = ecp_dir_item_serialize(&node->dir_item, msg[0]); + rv_ser = ecp_dir_serialize_item(&node->dir_item, msg[0]); msg[0] += rv_ser; count[0]++; if (region) { - rv_ser = ecp_dir_item_serialize(&node->dir_item, msg[region]); + rv_ser = ecp_dir_serialize_item(&node->dir_item, msg[region]); msg[region] += rv_ser; count[region]++; } @@ -642,13 +642,13 @@ void dir_online_switch(ECPSocket *sock, int inc_serial) { if (node->conn) ecp_conn_set_uflags(node->conn, DIR_UFLAG_RECONNECT); if (dir_online && verified) { - if (count[0] == MAX_DIR_ITEM_IN_MSG) { + if (count[0] == ECP_MAX_DIR_ITEM_IN_MSG) { dir_online->list[0].msg[msg_count[0]].count = count[0]; msg_count[0]++; msg[0] = dir_online->list[0].msg[msg_count[0]].buffer; count[0] = 0; } - if (region && count[region] == MAX_DIR_ITEM_IN_MSG) { + if (region && count[region] == ECP_MAX_DIR_ITEM_IN_MSG) { dir_online->list[region].msg[msg_count[region]].count = count[region]; msg_count[region]++; msg[region] = dir_online->list[region].msg[msg_count[region]].buffer; diff --git a/ecp/server/dir.h b/ecp/server/dir.h index 022010a..fee3a5e 100644 --- a/ecp/server/dir.h +++ b/ecp/server/dir.h @@ -1,7 +1,5 @@ -#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) +#define MAX_DIR_ITEM (MAX_DIR_MSG * ECP_MAX_DIR_ITEM_IN_MSG) #define MAX_DIR_ITEM_DIR 100 #define MAX_REGION 10 @@ -42,7 +40,7 @@ typedef struct DIRNode { typedef struct DIRList { struct { uint8_t count; - unsigned char buffer[MAX_DIR_ITEM_IN_MSG * ECP_SIZE_DIR_ITEM]; + unsigned char buffer[ECP_MAX_DIR_ITEM_IN_MSG * ECP_SIZE_DIR_ITEM]; } msg[MAX_DIR_MSG]; uint8_t msg_count; } DIRList; |