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

RPC experiment, not working

parent 638e3564
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,30 @@ Blob *Cluster::_lookup(const char *uri) {
auto b = blobs_[u.getBaseURI()];
std::cout << "Blob Found for " << u.getBaseURI() << " = " << (b != nullptr) << std::endl;
if (b == nullptr) {
// Must do a p2p search for this URI...
int rpcid = rpcid_++;
for (auto p : peers_) {
p->send(P2P_FINDOWNER, ftl::net::rpc_pack(rpcid,uri));
}
int limit = 10;
while (limit >= 0 && !rpc_results_[rpcid] == nullptr) {
ftl::net::wait();
limit--;
}
if (rpc_results[rpcid]) {
// Unpack the data
auto res = rpc_results[rpcid];
} else {
// No results;
}
}
return b;
}
......
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