diff --git a/graf3d/eve7/inc/ROOT/REveScene.hxx b/graf3d/eve7/inc/ROOT/REveScene.hxx index 52ed28257cfb6..1cd75f71bc651 100644 --- a/graf3d/eve7/inc/ROOT/REveScene.hxx +++ b/graf3d/eve7/inc/ROOT/REveScene.hxx @@ -107,6 +107,7 @@ public: void StreamMotionChanges(nlohmann::json &arr); void SendChangesToSubscribers(); + void ClearOutput(); /// Output of the last StreamElements() or StreamRepresentationChanges(). const std::string &GetOutputJson() const { return fOutputJson; } diff --git a/graf3d/eve7/src/REveManager.cxx b/graf3d/eve7/src/REveManager.cxx index 765f1af1cbc72..ab907bd65835c 100644 --- a/graf3d/eve7/src/REveManager.cxx +++ b/graf3d/eve7/src/REveManager.cxx @@ -889,6 +889,9 @@ void REveManager::StreamToNewConnection(unsigned connid) Send(connid, fWorld->fOutputJson); printf(" for now assume world-scene has no render data, binary-size=%d\n", fWorld->fTotalBinarySize); assert(fWorld->fTotalBinarySize == 0); + // Sent to this connection only; the next SendSceneChanges() must not send + // it to everyone again. + fWorld->ClearOutput(); for (auto &c : fScenes->RefChildren()) { REveScene *scene = dynamic_cast(c); @@ -911,6 +914,7 @@ void REveManager::StreamToNewConnection(unsigned connid) } else { printf(" NOT sending binary, len = %d\n", scene->fTotalBinarySize); } + scene->ClearOutput(); } fServerState.fCV.notify_all(); @@ -1302,6 +1306,9 @@ void REveManager::MIRExecThread() Send(mir->fConnId, scene->fOutputJson); if (scene->fTotalBinarySize > 0) SendBinary(mir->fConnId, &scene->fOutputBinary[0], scene->fTotalBinarySize); + // Streamed to this connection only; SendSceneChanges() below must + // not send it to every subscriber. + scene->ClearOutput(); } SendSceneChanges(); diff --git a/graf3d/eve7/src/REveScene.cxx b/graf3d/eve7/src/REveScene.cxx index 95cc14fa13277..f7069b4eea7f9 100644 --- a/graf3d/eve7/src/REveScene.cxx +++ b/graf3d/eve7/src/REveScene.cxx @@ -371,6 +371,17 @@ void REveScene::SendChangesToSubscribers() } REX::gEve->SceneSubscriberWaitingResponse(client->fId); } + ClearOutput(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Drop the output of the last StreamElements() or +/// StreamRepresentationChanges() once it has been sent, so that the next +/// SendChangesToSubscribers() does not send it again. REveManager calls this +/// after streaming a scene directly to one new connection. + +void REveScene::ClearOutput() +{ fOutputJson.clear(); fOutputBinary.clear(); fTotalBinarySize = 0;