From f7804687ddf6c715d2ce945cd5365540ab5ad860 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 5 Feb 2021 23:27:27 +0100 Subject: [PATCH] Immediately write host config file when a new key is received. When we receive a new public key, we should immediately call node_write_config() to ensure it gets saved if the storage policy is KEYS_ONLY. --- src/protocol_key.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/protocol_key.c b/src/protocol_key.c index dbe3d917..693b96db 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -170,6 +170,10 @@ static bool req_key_ext_h(meshlink_handle_t *mesh, connection_t *c, const char * logger(mesh, MESHLINK_INFO, "Learned ECDSA public key from %s", from->name); from->status.dirty = true; + if(!node_write_config(mesh, from, true)) { + // ignore + } + /* If we are trying to form an outgoing connection to this node, retry immediately */ for list_each(outgoing_t, outgoing, mesh->outgoings) { if(outgoing->node == from && outgoing->ev.cb) { -- 2.39.5