Mercurial > hg > orthanc
diff OrthancServer/Internals/CommandDispatcher.cpp @ 2134:ddc75c6c712d
Avoid hard crash if not enough memory
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Nov 2016 12:04:09 +0100 |
parents | 879f3be759ef |
children | a3a65de1840f |
line wrap: on
line diff
--- a/OrthancServer/Internals/CommandDispatcher.cpp Wed Nov 09 10:21:37 2016 +0100 +++ b/OrthancServer/Internals/CommandDispatcher.cpp Wed Nov 09 12:04:09 2016 +0100 @@ -381,7 +381,6 @@ OFCondition AssociationCleanup(T_ASC_Association *assoc) { - OFString temp_str; OFCondition cond = ASC_dropSCPAssociation(assoc); if (cond.bad()) { @@ -695,6 +694,38 @@ return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter); } + + CommandDispatcher::CommandDispatcher(const DicomServer& server, + T_ASC_Association* assoc, + const std::string& remoteIp, + const std::string& remoteAet, + const std::string& calledAet, + IApplicationEntityFilter* filter) : + server_(server), + assoc_(assoc), + remoteIp_(remoteIp), + remoteAet_(remoteAet), + calledAet_(calledAet), + filter_(filter) + { + associationTimeout_ = server.GetAssociationTimeout(); + elapsedTimeSinceLastCommand_ = 0; + } + + + CommandDispatcher::~CommandDispatcher() + { + try + { + AssociationCleanup(assoc_); + } + catch (...) + { + LOG(ERROR) << "Some association was not cleanly aborted"; + } + } + + bool CommandDispatcher::Step() /* * This function receives DIMSE commmands over the network connection