summaryrefslogtreecommitdiff
path: root/src/proto.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@slashwin.dk>2021-10-05 23:07:06 +0200
committerJesper Jensen <jesper@slashwin.dk>2021-10-05 23:07:06 +0200
commite0074d8b74f9e62df913a3817fc4cecf7cac2c69 (patch)
tree46696da2ad28b316e75543bc79d63cc3e8ad3d4c /src/proto.c
parent6e6829ad209550fbac0e363f9421c1fba78915b5 (diff)
Respond correctly no unknown query method
Diffstat (limited to 'src/proto.c')
-rw-r--r--src/proto.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/proto.c b/src/proto.c
index 8a6f0e8..cde232b 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -485,8 +485,19 @@ int handle_packet(struct dht* dht, time_t now, enum commandType type, char* tran
rc = handle_request(&dht->self, query, packet, packet_len, &cursor, end-cursor-1);
if(rc == QUERY_EUNK) {
- dbg("DISCARD: Unknown query method");
- return 0;
+ // The y key should have value e
+ *(cursor-4) = 'e';
+ // The r key is called e for errors
+ *(cursor-1) = 'e';
+
+ // Now create the payload
+ rc = snprintf(cursor, end-cursor, "li204e14:Unknown Methode");
+ if(rc < 0)
+ fatal("No space for response");
+ cursor += rc;
+ assert(cursor < end);
+
+ // Use the normal finalize flow
} else if(rc != 0) fatal("Error handling request");
rc = snprintf(cursor, end-cursor, "e");