diff --git a/components/streams/src/netstream.cpp b/components/streams/src/netstream.cpp index b497ac3dfa67c949ccba37aa37eddc271d727692..dfd3cfb4b9819ba1f9345c164f06284804d5a406 100644 --- a/components/streams/src/netstream.cpp +++ b/components/streams/src/netstream.cpp @@ -32,7 +32,7 @@ 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) { if (!net_->isBound("find_stream")) { - net_->bind("find_stream", [net = net_](const std::string &uri) -> optional<ftl::UUID> { + net_->bind("find_stream", [net = net_](const std::string &uri, bool proxy) -> optional<ftl::UUID> { LOG(INFO) << "REQUEST FIND STREAM: " << uri; ftl::URI u1(uri); @@ -242,7 +242,10 @@ bool Net::begin() { //} }); - auto p = net_->findOne<ftl::UUID>("find_stream", uri_); + // First find non-proxy version, then check for proxy version if no match + auto p = net_->findOne<ftl::UUID>("find_stream", uri_, false); + if (!p) p = net_->findOne<ftl::UUID>("find_stream", uri_, true); + if (!p) { LOG(INFO) << "Hosting stream: " << uri_; // TODO: Register URI as available. diff --git a/web-service/server/src/index.js b/web-service/server/src/index.js index 2510db14a53f4d09a0104b3b5afcd94f2b647583..22eb16270b00bc9a57ed09e986267adbbc0b31e7 100644 --- a/web-service/server/src/index.js +++ b/web-service/server/src/index.js @@ -380,7 +380,9 @@ app.ws('/', (ws, req) => { } }); - p.bind("find_stream", (uri) => { + p.bind("find_stream", (uri, proxy) => { + if (!proxy) return null; + const parsedURI = stringSplitter(uri) if (uri_to_peer.hasOwnProperty(parsedURI)) { console.log("Stream found: ", uri, parsedURI);