std::string commEngineName = a_originHost + "_DiameterCommEngine";
a_commEngine = new MyDiameterEngine(commEngineName.c_str(), baseProtocolDictionary);
a_commEngine->setAutoBind(false); // allow to create client-sessions without binding them, in order to set timeouts.
- a_codecEngine = anna::diameter::codec::EngineManager::instantiate().getCodecEngine(applicationId);
+ a_codecEngine = anna::diameter::codec::EngineManager::instantiate().getCodecEngine(applicationId); // i know, this is going to exist (getCodecEngine is not null)
a_logFile = "";
a_burstLogFile = "";
void ProgrammedAnswers::clear() throw () {
try {
anna::diameter::codec::EngineManager &em = anna::diameter::codec::EngineManager::instantiate();
+ anna::diameter::codec::Engine *engine;
+
for (reacting_answers_const_iterator it = a_deques.begin(); it != a_deques.end(); it++) {
anna::diameter::codec::Message *message = *(it->second->begin());
- em.getCodecEngine(message->getApplicationId())->releaseMessage(message);
- delete (it->second);
+ engine = em.getCodecEngine(message->getApplicationId());
+ if (engine) {
+ engine->releaseMessage(message);
+ delete (it->second);
+ }
+ else {
+ LOGWARNING(anna::Logger::warning("Cannot release a message for which i don't know the codec engine (check the registered stack id regarding the message application id) !", ANNA_FILE_LOCATION));
+ }
}
a_deques.clear();
}
}
void ProgrammedAnswers::nextMessage(int code) throw () { //pops the deque and release the message (when deque is not empty: deque::empty)
+ anna::diameter::codec::Engine *engine;
+
try {
reacting_answers_const_iterator it = a_deques.find(code);
if (it != a_deques.end()) {
if (!it->second->empty()) {
+ anna::diameter::codec::Message *message = *(it->second->begin());
if (a_rotate) {
- addMessage(code, *(it->second->begin()));
+ addMessage(code, message);
} else {
- anna::diameter::codec::EngineManager &em = anna::diameter::codec::EngineManager::instantiate();
- anna::diameter::codec::Message *message = *(it->second->begin());
- em.getCodecEngine(message->getApplicationId())->releaseMessage(message);
+ engine = anna::diameter::codec::EngineManager::instantiate().getCodecEngine(message->getApplicationId());
+ if (engine) {
+ engine->releaseMessage(message);
+ }
+ else {
+ LOGWARNING(anna::Logger::warning("Cannot release a message for which i don't know the codec engine (check the registered stack id regarding the message application id) !", ANNA_FILE_LOCATION));
+ return;
+ }
}
it->second->pop_front();
}
void LocalServer::initializeStatisticResources() throw() {
- std::string accName = "local server '";
+ std::string accName = "sent from local server '";
accName += anna::functions::socketLiteralAsString(a_key.first, a_key.second);
accName += "' on origin-realm '";
accName += a_engine ? a_engine->getOriginRealm() : "unknown"; // it should be known (createServer)
}
void Server::initializeStatisticResources() throw() {
- std::string accName = "remote server '";
+ std::string accName = "sent to remote server '";
accName += anna::functions::socketLiteralAsString(a_socket.first, a_socket.second);
accName += "' from origin-realm '";
accName += a_engine ? a_engine->getOriginRealm() : "unknown"; // it should be known (createServer)