Mercurial > hg > orthanc-stone
diff Framework/Loaders/LoaderStateMachine.cpp @ 964:91f827272c1f toa2019082701
Added cache-control headers for POST requests + #ifdef'd tracing logs + trace on context restored
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 27 Aug 2019 14:28:19 +0200 |
parents | a7351ad54960 |
children | 38409549db43 |
line wrap: on
line diff
--- a/Framework/Loaders/LoaderStateMachine.cpp Mon Aug 26 11:03:14 2019 +0200 +++ b/Framework/Loaders/LoaderStateMachine.cpp Tue Aug 27 14:28:19 2019 +0200 @@ -23,6 +23,11 @@ #include <Core/OrthancException.h> +#if 0 +extern bool logbgo233; +extern bool logbgo115; +#endif + namespace OrthancStone { void LoaderStateMachine::State::Handle(const OrthancRestApiCommand::SuccessMessage& message) @@ -45,6 +50,13 @@ void LoaderStateMachine::Schedule(OracleCommandWithPayload* command) { +#if 0 + if (logbgo233) { + if (logbgo115) + LOG(TRACE) << " LoaderStateMachine::Schedule()"; + } +#endif + std::auto_ptr<OracleCommandWithPayload> protection(command); if (command == NULL) @@ -58,7 +70,14 @@ "The payload must contain the next state"); } +#if 0 + if (logbgo233) { + if (logbgo115) + LOG(TRACE) << " * LoaderStateMachine::Schedule(): adding command with addr: " << std::hex << protection.get() << std::dec << " pendingCommands_.size() is now : " << pendingCommands_.size()+1; + } +#endif pendingCommands_.push_back(protection.release()); + Step(); } @@ -67,7 +86,7 @@ { if (active_) { - LOG(ERROR) << "LoaderStateMachine::Start() called while active_ is true"; + LOG(TRACE) << "LoaderStateMachine::Start() called while active_ is true"; throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); } @@ -82,14 +101,37 @@ void LoaderStateMachine::Step() { +#if 0 + if (logbgo115) + LOG(TRACE) << " LoaderStateMachine::Step(): pendingCommands_.size() = " << pendingCommands_.size(); +#endif if (!pendingCommands_.empty() && activeCommands_ < simultaneousDownloads_) { - oracle_.Schedule(*this, pendingCommands_.front()); + + IOracleCommand* nextCommand = pendingCommands_.front(); + +#if 0 + if (logbgo233) { + if (logbgo115) + LOG(TRACE) << " * LoaderStateMachine::Step(): activeCommands_ (" << activeCommands_ << ") < simultaneousDownloads_ (" << simultaneousDownloads_ << ") --> will Schedule command addr " << std::hex << nextCommand << std::dec; + } +#endif + + oracle_.Schedule(*this, nextCommand); pendingCommands_.pop_front(); activeCommands_++; } + else + { +#if 0 + if (logbgo233) { + if (logbgo115) + LOG(TRACE) << " * pendingCommands_.size() == " << pendingCommands_.size() << " LoaderStateMachine::Step(): activeCommands_ (" << activeCommands_ << ") >= simultaneousDownloads_ (" << simultaneousDownloads_ << ") --> will NOT Schedule anything"; + } +#endif + } }