Ensure proper treatement of the LMDB values
Summary
During the commissioning with legacy software, it was discovered that some registers in some version of the address table couldn't be read from the LMDB address table. The RPC method blocks into an infinite loop. It was traced back to an invalid usage of the LMDB values to construct the std::string
.
The same code is being used inside the development software and therefore requires a similar fix.
Steps to reproduce
Magical bug.
What is the expected correct behavior?
All registers can be read seamlessly from the LMDB address table.
Construct the std::string
with a given length instead of resizing it later in gemrpc/src/utils.cpp
, e.g.
std::string t_db_res = std::string(db_res.data());
t_db_res = t_db_res.substr(0,db_res.size());
std::vector<std::string> tmp = split(t_db_res,'|');
const std::string t_db_res{db_res.data(), db_res.size()};
const std::vector<std::string> tmp = split(t_db_res,'|');