Skip to content
Snippets Groups Projects
Commit 77575990 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix UUID to string for platform consistency

parent 90aaa7fa
No related branches found
No related tags found
No related merge requests found
Pipeline #11989 passed
......@@ -75,6 +75,7 @@ vector<json_t> Master::getSlaves() {
vector<json_t> result;
for (auto &r : response) {
result.push_back(json_t::parse(r));
LOG(INFO) << "Node details: " << result[result.size()-1];
}
return result;
}
......@@ -84,7 +85,11 @@ vector<string> Master::getConfigurables() {
}
vector<string> Master::getConfigurables(const ftl::UUID &peer) {
return net_->call<vector<string>>(peer, "list_configurables");
try {
return net_->call<vector<string>>(peer, "list_configurables");
} catch (...) {
return {};
}
}
vector<json_t> Master::get(const string &uri) {
......
......@@ -361,7 +361,8 @@ template <typename R, typename... ARGS>
R Universe::call(const ftl::UUID &pid, const std::string &name, ARGS... args) {
Peer *p = getPeer(pid);
if (p == nullptr || !p->isConnected()) {
DLOG(WARNING) << "Attempting to call an unknown peer : " << pid.to_string();
if (p == nullptr) DLOG(WARNING) << "Attempting to call an unknown peer : " << pid.to_string();
else DLOG(WARNING) << "Attempting to call an disconnected peer : " << pid.to_string();
throw -1;
}
return p->call<R>(name, args...);
......
......@@ -60,6 +60,15 @@ namespace ftl {
* Get a pretty string.
*/
std::string to_string() const {
static const char *digits = "0123456789abcdef";
std::string rc(sizeof(uuid_)*2,'0');
for (size_t i=0 ; i<16; ++i) {
rc[i*2] = digits[uuid_[i] & 0x0f];
rc[i*2+1] = digits[(uuid_[i] >> 4) & 0x0f];
}
return rc;
/*
#ifdef WIN32
RPC_CSTR szUuid = NULL;
if (::UuidToStringA(&guid_, &szUuid) == RPC_S_OK) {
......@@ -71,6 +80,7 @@ namespace ftl {
uuid_unparse(uuid_, b);
return std::string(b);
#endif
*/
}
/* Allow the UUID to be packed into an RPC message. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment