Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestApi.cpp @ 1730:bc34c69b594a
New URI "/tools/shutdown" to stop Orthanc from the REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 21 Oct 2015 10:34:29 +0200 |
parents | 904096e7367e |
children | b1291df2f780 |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Tue Oct 20 11:22:50 2015 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestApi.cpp Wed Oct 21 10:34:29 2015 +0200 @@ -59,11 +59,20 @@ void OrthancRestApi::ResetOrthanc(RestApiPostCall& call) { + OrthancRestApi::GetApi(call).leaveBarrier_ = true; OrthancRestApi::GetApi(call).resetRequestReceived_ = true; call.GetOutput().AnswerBuffer("{}", "application/json"); } + void OrthancRestApi::ShutdownOrthanc(RestApiPostCall& call) + { + OrthancRestApi::GetApi(call).leaveBarrier_ = true; + call.GetOutput().AnswerBuffer("{}", "application/json"); + LOG(WARNING) << "Shutdown request received"; + } + + @@ -99,6 +108,7 @@ OrthancRestApi::OrthancRestApi(ServerContext& context) : context_(context), + leaveBarrier_(false), resetRequestReceived_(false) { RegisterSystem(); @@ -114,6 +124,7 @@ // Auto-generated directories Register("/tools", RestApi::AutoListChildren); Register("/tools/reset", ResetOrthanc); + Register("/tools/shutdown", ShutdownOrthanc); Register("/instances/{id}/frames/{frame}", RestApi::AutoListChildren); }