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
Branches
Tags
No related merge requests found
Pipeline #11989 passed
...@@ -75,6 +75,7 @@ vector<json_t> Master::getSlaves() { ...@@ -75,6 +75,7 @@ vector<json_t> Master::getSlaves() {
vector<json_t> result; vector<json_t> result;
for (auto &r : response) { for (auto &r : response) {
result.push_back(json_t::parse(r)); result.push_back(json_t::parse(r));
LOG(INFO) << "Node details: " << result[result.size()-1];
} }
return result; return result;
} }
...@@ -84,7 +85,11 @@ vector<string> Master::getConfigurables() { ...@@ -84,7 +85,11 @@ vector<string> Master::getConfigurables() {
} }
vector<string> Master::getConfigurables(const ftl::UUID &peer) { vector<string> Master::getConfigurables(const ftl::UUID &peer) {
try {
return net_->call<vector<string>>(peer, "list_configurables"); return net_->call<vector<string>>(peer, "list_configurables");
} catch (...) {
return {};
}
} }
vector<json_t> Master::get(const string &uri) { vector<json_t> Master::get(const string &uri) {
......
...@@ -361,7 +361,8 @@ template <typename R, typename... ARGS> ...@@ -361,7 +361,8 @@ template <typename R, typename... ARGS>
R Universe::call(const ftl::UUID &pid, const std::string &name, ARGS... args) { R Universe::call(const ftl::UUID &pid, const std::string &name, ARGS... args) {
Peer *p = getPeer(pid); Peer *p = getPeer(pid);
if (p == nullptr || !p->isConnected()) { 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; throw -1;
} }
return p->call<R>(name, args...); return p->call<R>(name, args...);
......
...@@ -60,6 +60,15 @@ namespace ftl { ...@@ -60,6 +60,15 @@ namespace ftl {
* Get a pretty string. * Get a pretty string.
*/ */
std::string to_string() const { 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 #ifdef WIN32
RPC_CSTR szUuid = NULL; RPC_CSTR szUuid = NULL;
if (::UuidToStringA(&guid_, &szUuid) == RPC_S_OK) { if (::UuidToStringA(&guid_, &szUuid) == RPC_S_OK) {
...@@ -71,6 +80,7 @@ namespace ftl { ...@@ -71,6 +80,7 @@ namespace ftl {
uuid_unparse(uuid_, b); uuid_unparse(uuid_, b);
return std::string(b); return std::string(b);
#endif #endif
*/
} }
/* Allow the UUID to be packed into an RPC message. */ /* 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.
Please register or to comment