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

Fix for missing group in URI

parent 0a47113d
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
...@@ -32,17 +32,17 @@ static SHARED_MUTEX stream_mutex; ...@@ -32,17 +32,17 @@ static SHARED_MUTEX stream_mutex;
Net::Net(nlohmann::json &config, ftl::net::Universe *net) : Stream(config), active_(false), net_(net), clock_adjust_(0), last_ping_(0) { Net::Net(nlohmann::json &config, ftl::net::Universe *net) : Stream(config), active_(false), net_(net), clock_adjust_(0), last_ping_(0) {
if (!net_->isBound("find_stream")) { if (!net_->isBound("find_stream")) {
// FIXME: This only allows for a single net stream!!!
net_->bind("find_stream", [net = net_](const std::string &uri) -> optional<ftl::UUID> { net_->bind("find_stream", [net = net_](const std::string &uri) -> optional<ftl::UUID> {
LOG(INFO) << "REQUEST FIND STREAM: " << uri; LOG(INFO) << "REQUEST FIND STREAM: " << uri;
ftl::URI u(uri); ftl::URI u1(uri);
std::string base = u.getBaseURI(); std::string base = u1.getBaseURI();
SHARED_LOCK(stream_mutex, lk); SHARED_LOCK(stream_mutex, lk);
for (const auto &s : net_streams) { for (const auto &s : net_streams) {
ftl::URI u2(s);
// Don't compare query string components. // Don't compare query string components.
if (base == s) { if (base == u2.getBaseURI()) {
return net->id(); return net->id();
} }
} }
...@@ -256,7 +256,7 @@ bool Net::begin() { ...@@ -256,7 +256,7 @@ bool Net::begin() {
{ {
UNIQUE_LOCK(stream_mutex, lk); UNIQUE_LOCK(stream_mutex, lk);
net_streams.push_back(base_uri_); net_streams.push_back(uri_);
} }
// Automatically set name if missing // Automatically set name if missing
...@@ -442,7 +442,7 @@ bool Net::end() { ...@@ -442,7 +442,7 @@ bool Net::end() {
{ {
UNIQUE_LOCK(stream_mutex, lk); UNIQUE_LOCK(stream_mutex, lk);
auto i = std::find(net_streams.begin(), net_streams.end(), base_uri_); auto i = std::find(net_streams.begin(), net_streams.end(), uri_);
if (i != net_streams.end()) net_streams.erase(i); if (i != net_streams.end()) net_streams.erase(i);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment