Mercurial > hg > orthanc
changeset 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 | 0c2b719c3796 |
children | b6e7714c3fe6 |
files | NEWS OrthancServer/OrthancMoveRequestHandler.cpp |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Jan 22 12:55:41 2019 +0100 +++ b/NEWS Wed Jan 23 09:32:59 2019 +0100 @@ -2,6 +2,7 @@ =============================== * Fix compatibility with DICOMweb plugin (allow multipart answers over HTTP Keep-Alive) +* Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations) Version 1.5.2 (2019-01-18)
--- 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; } }; }