summaryrefslogtreecommitdiff
path: root/src/query.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-07-03 21:37:46 +0200
committerJesper Jensen <jesper@jnsn.dev>2025-07-03 22:18:59 +0200
commita46e9a5cbb8fc233a0ccb47708e7686c2b561ac0 (patch)
tree7623f70cb31ca38ab63730dda8ed9b4ad039184b /src/query.c
parent75e3fd649bf4baae66a7415634fe999c726ba149 (diff)
Only save config when there are worthy changes
Diffstat (limited to 'src/query.c')
-rw-r--r--src/query.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/query.c b/src/query.c
index 2276ac1..a8643f1 100644
--- a/src/query.c
+++ b/src/query.c
@@ -9,7 +9,7 @@
#include <assert.h>
#include <arpa/inet.h>
-int handle_request(struct nodeid* self, struct tokens *tokens, time_t now, const char* method, const struct sockaddr* src, socklen_t src_len, const char* packet, size_t packet_len, char** response, size_t response_len) {
+int handle_request(struct nodeid* self, struct tokens* tokens, bool *dirtyconf, time_t now, const char* method, const struct sockaddr* src, socklen_t src_len, const char* packet, size_t packet_len, char** response, size_t response_len) {
if(method == NULL) {
return QUERY_EBADQ;
}
@@ -472,6 +472,7 @@ int handle_request(struct nodeid* self, struct tokens *tokens, time_t now, const
src_addr.port = htons(port);
}
int rc = add_peer(&infohash, &src_addr, now);
+ *dirtyconf = true;
if(rc == PEER_EFULL) {
} else if(rc != 0) {
fatal("Could not add peer (%d)", rc);