# HG changeset patch # User Sebastien Jodogne # Date 1548232379 -3600 # Node ID 8a9eb767280cd575ec4e3d9b0249b304956679c6 # Parent 0c2b719c37960828358ec2680b5af04ecd4dad91 Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations) diff -r 0c2b719c3796 -r 8a9eb767280c NEWS --- 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) diff -r 0c2b719c3796 -r 8a9eb767280c OrthancServer/OrthancMoveRequestHandler.cpp --- 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 job_; size_t position_; + size_t countInstances_; public: AsynchronousMove(ServerContext& context, @@ -156,6 +157,8 @@ std::list tmp; context_.GetIndex().GetChildInstances(tmp, publicId); + countInstances_ = tmp.size(); + job_->Reserve(tmp.size()); for (std::list::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; } }; }