From 47d4780eb448f839fc6b0644135395f879080ba4 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sun, 23 Jul 2023 12:15:34 +0200 Subject: I don't remember --- src/proto.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/proto.h') diff --git a/src/proto.h b/src/proto.h index 1bdc05d..0ce887e 100644 --- a/src/proto.h +++ b/src/proto.h @@ -26,7 +26,7 @@ struct dht; struct msgbuff; #define PROCESS_REPONSE(NAME) int (NAME)(struct dht* dht, time_t now, union message_cont* cont, char* packet, size_t packet_len, int socket, struct sockaddr* remote, socklen_t remote_len, struct msgbuff* msgbuff) -typedef PROCESS_REPONSE(cont); +typedef PROCESS_REPONSE(resp); #define PROCESS_TIMEOUT(NAME) int (NAME)(struct dht* dht, struct nodeid* self, time_t now, union message_cont* cont, struct msgbuff* msgbuff) typedef PROCESS_TIMEOUT(tmout); @@ -41,15 +41,29 @@ struct dht { struct { struct sockaddr_storage addr; socklen_t addr_len; - cont* fun; + resp* fun; time_t timeout; tmout* timeout_fun; union message_cont cont; } requestdata[MAX_INFLIGHT]; }; +// @HACK: This isn't true anymore +// The longest message we can send is probably a response to find_node which +// consists of: +// d1:t <-- 4 bytes +// <-- 2 bytes +// : <-- 1 byte +// <-- 16 bytes* +// 1:y1:r1:r <-- 9 bytes +// d2:id20: <-- 8 bytes +// <-- 20 bytes +// 5:nodes208: <-- 11 bytes +// <-- 208 bytes +// ee <-- 2 bytes +// TOTAL 281 bytes struct message { - char payload[1024]; + char payload[281]; size_t payload_len; struct sockaddr_storage dest; socklen_t dest_len; -- cgit v1.2.3