Mercurial > hg > orthanc
diff OrthancServer/OrthancMoveRequestHandler.cpp @ 3157:8a9eb767280c
Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Jan 2019 09:32:59 +0100 |
parents | ac72032d69a2 |
children | 8ea7c4546c3a |
line wrap: on
line diff
--- a/OrthancServer/OrthancMoveRequestHandler.cpp Tue Jan 22 12:55:41 2019 +0100 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Wed Jan 23 09:32:59 2019 +0100 @@ -125,6 +125,7 @@ ServerContext& context_; std::auto_ptr<DicomModalityStoreJob> job_; size_t position_; + size_t countInstances_; public: AsynchronousMove(ServerContext& context, @@ -156,6 +157,8 @@ std::list<std::string> tmp; context_.GetIndex().GetChildInstances(tmp, publicId); + countInstances_ = tmp.size(); + job_->Reserve(tmp.size()); for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); ++it) @@ -166,20 +169,23 @@ virtual unsigned int GetSubOperationCount() const { - return 1; + return countInstances_; } virtual Status DoNext() { + if (position_ >= countInstances_) + { + return Status_Failure; + } + if (position_ == 0) { context_.GetJobsEngine().GetRegistry().Submit(job_.release(), 0 /* priority */); - return Status_Success; } - else - { - return Status_Failure; - } + + position_ ++; + return Status_Success; } }; }