Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1675:131136aeeaa7 | 1676:f079f3efe33b |
---|---|
59 | 59 |
60 | 60 |
61 void DicomServer::ServerThread(DicomServer* server, | 61 void DicomServer::ServerThread(DicomServer* server, |
62 T_ASC_Network *network) | 62 T_ASC_Network *network) |
63 { | 63 { |
64 LOG(INFO) << "DICOM server started"; | 64 LOG(INFO) << "DICOM server started"; |
65 | 65 |
66 while (server->continue_) | 66 while (server->continue_) |
67 { | |
68 /* receive an association and acknowledge or reject it. If the association was */ | |
69 /* acknowledged, offer corresponding services and invoke one or more if required. */ | |
70 std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, network)); | |
71 | |
72 try | |
67 { | 73 { |
68 /* receive an association and acknowledge or reject it. If the association was */ | 74 if (dispatcher.get() != NULL) |
69 /* acknowledged, offer corresponding services and invoke one or more if required. */ | |
70 std::auto_ptr<Internals::CommandDispatcher> dispatcher(Internals::AcceptAssociation(*server, network)); | |
71 | |
72 try | |
73 { | 75 { |
74 if (dispatcher.get() != NULL) | 76 if (server->isThreaded_) |
75 { | 77 { |
76 if (server->isThreaded_) | 78 server->bagOfDispatchers_.Add(dispatcher.release()); |
77 { | 79 } |
78 server->bagOfDispatchers_.Add(dispatcher.release()); | 80 else |
79 } | 81 { |
80 else | 82 IRunnableBySteps::RunUntilDone(*dispatcher); |
81 { | |
82 IRunnableBySteps::RunUntilDone(*dispatcher); | |
83 } | |
84 } | 83 } |
85 } | 84 } |
86 catch (OrthancException& e) | |
87 { | |
88 LOG(ERROR) << "Exception in the DICOM server thread: " << e.What(); | |
89 } | |
90 } | 85 } |
91 | 86 catch (OrthancException& e) |
92 LOG(INFO) << "DICOM server stopping"; | |
93 | |
94 if (server->isThreaded_) | |
95 { | 87 { |
96 server->bagOfDispatchers_.StopAll(); | 88 LOG(ERROR) << "Exception in the DICOM server thread: " << e.What(); |
97 } | 89 } |
98 | 90 } |
99 /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ | 91 |
100 /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ | 92 LOG(INFO) << "DICOM server stopping"; |
101 OFCondition cond = ASC_dropNetwork(&network); | 93 |
102 if (cond.bad()) | 94 if (server->isThreaded_) |
103 { | 95 { |
104 LOG(ERROR) << "Error while dropping the network: " << cond.text(); | 96 server->bagOfDispatchers_.StopAll(); |
105 } | 97 } |
98 | |
99 /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ | |
100 /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ | |
101 OFCondition cond = ASC_dropNetwork(&network); | |
102 if (cond.bad()) | |
103 { | |
104 LOG(ERROR) << "Error while dropping the network: " << cond.text(); | |
105 } | |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 DicomServer::DicomServer() : | 109 DicomServer::DicomServer() : |
110 pimpl_(new PImpl), | 110 pimpl_(new PImpl), |