# HG changeset patch # User Sebastien Jodogne # Date 1526394523 -7200 # Node ID 5e2730c8e23c0c76412c6bd2d8ee2df45dc35180 # Parent a3fdfb6979eddb84be4578aea3ff9d364255aa4c getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler diff -r a3fdfb6979ed -r 5e2730c8e23c OrthancServer/OrthancMoveRequestHandler.cpp --- a/OrthancServer/OrthancMoveRequestHandler.cpp Tue May 15 16:10:03 2018 +0200 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Tue May 15 16:28:43 2018 +0200 @@ -55,6 +55,7 @@ RemoteModalityParameters remote_; std::string originatorAet_; uint16_t originatorId_; + std::auto_ptr connection_; public: OrthancMoveRequestIterator(ServerContext& context, @@ -99,12 +100,13 @@ std::string dicom; context_.ReadDicom(dicom, id); + if (connection_.get() == NULL) { - ReusableDicomUserConnection::Locker locker - (context_.GetReusableDicomUserConnection(), localAet_, remote_); - locker.GetConnection().Store(dicom, originatorAet_, originatorId_); + connection_.reset(new DicomUserConnection(localAet_, remote_)); } + connection_->Store(dicom, originatorAet_, originatorId_); + return Status_Success; } }; diff -r a3fdfb6979ed -r 5e2730c8e23c OrthancServer/QueryRetrieveHandler.cpp --- a/OrthancServer/QueryRetrieveHandler.cpp Tue May 15 16:10:03 2018 +0200 +++ b/OrthancServer/QueryRetrieveHandler.cpp Tue May 15 16:28:43 2018 +0200 @@ -76,6 +76,19 @@ { done_ = false; answers_.Clear(); + connection_.reset(NULL); + } + + + DicomUserConnection& QueryRetrieveHandler::GetConnection() + { + if (connection_.get() == NULL) + { + connection_.reset(new DicomUserConnection(localAet_, modality_)); + connection_->Open(); + } + + return *connection_; } @@ -91,11 +104,7 @@ // Secondly, possibly fix the query with the user-provider Lua callback FixQuery(fixed, context_, modality_.GetApplicationEntityTitle()); - { - // Finally, run the C-FIND SCU against the fixed query - ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_); - locker.GetConnection().Find(answers_, level_, fixed); - } + GetConnection().Find(answers_, level_, fixed); done_ = true; } @@ -155,11 +164,7 @@ { DicomMap map; GetAnswer(map, i); - - { - ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_); - locker.GetConnection().Move(target, map); - } + GetConnection().Move(target, map); } diff -r a3fdfb6979ed -r 5e2730c8e23c OrthancServer/QueryRetrieveHandler.h --- a/OrthancServer/QueryRetrieveHandler.h Tue May 15 16:10:03 2018 +0200 +++ b/OrthancServer/QueryRetrieveHandler.h Tue May 15 16:28:43 2018 +0200 @@ -49,8 +49,11 @@ DicomFindAnswers answers_; std::string modalityName_; + std::auto_ptr connection_; + void Invalidate(); + DicomUserConnection& GetConnection(); public: QueryRetrieveHandler(ServerContext& context);