From fa6ceb2bf4503c54fe7e8a150906fa111c793b5c Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 12 Mar 2020 00:35:16 +0100 Subject: [PATCH] add: transfer missing properties in discovery fix: save \0 in lmdb --- discovery.c | 3 +++ models/controller_save.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/discovery.c b/discovery.c index b67c91a..b1ae4d6 100644 --- a/discovery.c +++ b/discovery.c @@ -95,6 +95,9 @@ discovery_handle_discover(int fd, controller *cntrlr) binn *map = binn_map(); binn_map_set_blob(map, DISCOVERY_MAPPING_ID, &cntrlr->id, sizeof(uuid_t)); + binn_map_set_str(map, DISCOVERY_MAPPING_NAME, cntrlr->name); + binn_map_set_uint32(map, DISCOVERY_MAPPING_COMMAND_PORT, cntrlr->command_port); + binn_map_set_uint8(map, DISCOVERY_MAPPING_RELAY_COUNT, cntrlr->relay_count); void *payload = binn_ptr(map); size_t payload_size = binn_size(map); diff --git a/models/controller_save.c b/models/controller_save.c index cceeb9e..b99c8a9 100644 --- a/models/controller_save.c +++ b/models/controller_save.c @@ -55,7 +55,7 @@ controller_save(controller *cntrlr, MDB_env *mdb_env) return 1; } - value.mv_size = sizeof(char) * strlen(cntrlr->name); + value.mv_size = sizeof(char) * (strlen(cntrlr->name) + 1); value.mv_data = cntrlr->name; if(controller_save_single(mdb_txn, mdb_dbi, KEY_META_NAME, value)) {