Mercurial > hg > orthanc
diff OrthancServer/main.cpp @ 941:83489fddd8c5
Options to limit the number of results for an incoming C-FIND query
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Jun 2014 11:08:11 +0200 |
parents | 84513f2ee1f3 |
children | 3fb427ac3f53 c2c28dd17e87 e57e08ed510f cf52f3bcb2b3 |
line wrap: on
line diff
--- a/OrthancServer/main.cpp Wed Jun 25 09:06:34 2014 +0200 +++ b/OrthancServer/main.cpp Wed Jun 25 11:08:11 2014 +0200 @@ -98,7 +98,32 @@ virtual IFindRequestHandler* ConstructFindRequestHandler() { - return new OrthancFindRequestHandler(context_); + std::auto_ptr<OrthancFindRequestHandler> result(new OrthancFindRequestHandler(context_)); + + result->SetMaxResults(Configuration::GetGlobalIntegerParameter("LimitFindResults", 0)); + result->SetMaxInstances(Configuration::GetGlobalIntegerParameter("LimitFindInstances", 0)); + + if (result->GetMaxResults() == 0) + { + LOG(INFO) << "No limit on the number of C-FIND results at the Patient, Study and Series levels"; + } + else + { + LOG(INFO) << "Maximum " << result->GetMaxResults() + << " results for C-FIND queries at the Patient, Study and Series levels"; + } + + if (result->GetMaxInstances() == 0) + { + LOG(INFO) << "No limit on the number of C-FIND results at the Instance level"; + } + else + { + LOG(INFO) << "Maximum " << result->GetMaxInstances() + << " instances will be returned for C-FIND queries at the Instance level"; + } + + return result.release(); } virtual IMoveRequestHandler* ConstructMoveRequestHandler()