diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2023-07-23 12:15:34 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-04-12 10:21:20 +0200 |
| commit | 47d4780eb448f839fc6b0644135395f879080ba4 (patch) | |
| tree | 2c9a84bf45a4b8af5411331db50173fc5a34f630 /src/proto.h | |
| parent | 3515701479fe04f73e9194ee3074457bb85030f6 (diff) | |
I don't remember
Diffstat (limited to 'src/proto.h')
| -rw-r--r-- | src/proto.h | 20 |
1 files changed, 17 insertions, 3 deletions
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 +// <tid length> <-- 2 bytes +// : <-- 1 byte +// <tid> <-- 16 bytes* +// 1:y1:r1:r <-- 9 bytes +// d2:id20: <-- 8 bytes +// <our nodeid> <-- 20 bytes +// 5:nodes208: <-- 11 bytes +// <payload> <-- 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; |
