add: transfer missing properties in discovery

fix: save \0 in lmdb
This commit is contained in:
Tobias Reisinger 2020-03-12 00:35:16 +01:00
parent d679d99a92
commit fa6ceb2bf4
2 changed files with 4 additions and 1 deletions

View file

@ -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);

View file

@ -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))
{