Mercurial > hg > orthanc
diff OrthancServer/DicomProtocol/DicomServer.cpp @ 1676:f079f3efe33b db-changes
patient tags reported in studies
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Oct 2015 17:09:18 +0200 |
parents | 131136aeeaa7 |
children | 6414043df7d8 |
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomServer.cpp Fri Oct 02 13:57:54 2015 +0200 +++ b/OrthancServer/DicomProtocol/DicomServer.cpp Fri Oct 02 17:09:18 2015 +0200 @@ -61,48 +61,48 @@ void DicomServer::ServerThread(DicomServer* server, T_ASC_Network *network) { - LOG(INFO) << "DICOM server started"; + LOG(INFO) << "DICOM server started"; - while (server->continue_) + while (server->continue_) + { + /* receive an association and acknowledge or reject it. If the association was */ + /* acknowledged, offer corresponding services and invoke one or more if required. */ + std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, network)); + + try { - /* receive an association and acknowledge or reject it. If the association was */ - /* acknowledged, offer corresponding services and invoke one or more if required. */ - std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, network)); - - try + if (dispatcher.get() != NULL) { - if (dispatcher.get() != NULL) + if (server->isThreaded_) { - if (server->isThreaded_) - { - server->bagOfDispatchers_.Add(dispatcher.release()); - } - else - { - IRunnableBySteps::RunUntilDone(*dispatcher); - } + server->bagOfDispatchers_.Add(dispatcher.release()); + } + else + { + IRunnableBySteps::RunUntilDone(*dispatcher); } } - catch (OrthancException& e) - { - LOG(ERROR) << "Exception in the DICOM server thread: " << e.What(); - } } - - LOG(INFO) << "DICOM server stopping"; - - if (server->isThreaded_) + catch (OrthancException& e) { - server->bagOfDispatchers_.StopAll(); + LOG(ERROR) << "Exception in the DICOM server thread: " << e.What(); } + } + + LOG(INFO) << "DICOM server stopping"; - /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ - /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ - OFCondition cond = ASC_dropNetwork(&network); - if (cond.bad()) - { - LOG(ERROR) << "Error while dropping the network: " << cond.text(); - } + if (server->isThreaded_) + { + server->bagOfDispatchers_.StopAll(); + } + + /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ + /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ + OFCondition cond = ASC_dropNetwork(&network); + if (cond.bad()) + { + LOG(ERROR) << "Error while dropping the network: " << cond.text(); + } }