comparison Framework/Loaders/LoaderStateMachine.cpp @ 975:e75fd08d6c75 toa2019083101

Cleaning in ICallable + changed fingerprint to plain char array to allow for dead object examination + additional check in FetchContext callback to avoid the unexplained rogue callbacks I have seen + protection in LoaderStateMachine::HandleSuccessMessage in case things go wrong anyway
author Benjamin Golinvaux <bgo@osimis.io>
date Sat, 31 Aug 2019 13:45:04 +0200
parents 38409549db43
children 262a0244e9b2
comparison
equal deleted inserted replaced
974:e4b028c1ede1 975:e75fd08d6c75
137 void LoaderStateMachine::HandleSuccessMessage(const T& message) 137 void LoaderStateMachine::HandleSuccessMessage(const T& message)
138 { 138 {
139 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage()"; 139 LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage()";
140 if (activeCommands_ <= 0) { 140 if (activeCommands_ <= 0) {
141 LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage : activeCommands_ should be > 0 but is: " << activeCommands_; 141 LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage : activeCommands_ should be > 0 but is: " << activeCommands_;
142 } 142 LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ") fingerprint = " << GetFingerprint();
143 activeCommands_--; 143 }
144 144 else {
145 try 145 activeCommands_--;
146 { 146 try
147 dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message); 147 {
148 Step(); 148 dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message);
149 } 149 Step();
150 catch (Orthanc::OrthancException& e) 150 }
151 { 151 catch (Orthanc::OrthancException& e)
152 LOG(ERROR) << "Error in the state machine, stopping all processing: " << 152 {
153 e.What() << " Details: " << e.GetDetails(); 153 LOG(ERROR) << "Error in the state machine, stopping all processing: " <<
154 Clear(); 154 e.What() << " Details: " << e.GetDetails();
155 Clear();
156 }
155 } 157 }
156 } 158 }
157 159
158 160
159 LoaderStateMachine::LoaderStateMachine(IOracle& oracle, 161 LoaderStateMachine::LoaderStateMachine(IOracle& oracle,