Fix local server for multiple applications
[anna.git] / example / diameter / launcher / MyDiameterEntity.cpp
index f0864df..cba726a 100644 (file)
@@ -24,7 +24,7 @@
 #include <anna/testing/TestManager.hpp>
 
 
-void MyDiameterEntity::eventRequestRetransmission(const anna::diameter::comm::ClientSession* clientSession, anna::diameter::comm::Message *request) throw() {
+void MyDiameterEntity::eventRequestRetransmission(const anna::diameter::comm::ClientSession* clientSession, anna::diameter::comm::Message *request) {
 
   LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventRequestRetransmission", ANNA_FILE_LOCATION));
 
@@ -52,8 +52,8 @@ void MyDiameterEntity::eventRequestRetransmission(const anna::diameter::comm::Cl
 }
 
 
-void MyDiameterEntity::eventRequest(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message)
-throw(anna::RuntimeException) {
+void MyDiameterEntity::eventRequest(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message, const anna::diameter::comm::OriginHost *myNode)
+noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventRequest", ANNA_FILE_LOCATION));
   // Performance stats:
   Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());
@@ -77,7 +77,7 @@ throw(anna::RuntimeException) {
 
   // Lookup reacting answers list:
   int code = cid.first;
-  anna::diameter::codec::Message *answer_message = a_reactingAnswers.getMessage(code);
+  anna::diameter::codec::Message *answer_message = my_node->getReactingAnswers()->getMessage(code);
   if (answer_message) {
     // Prepare answer:
     my_app.getCommunicator()->prepareAnswer(answer_message, message);
@@ -99,7 +99,7 @@ throw(anna::RuntimeException) {
     my_node->releaseCommMessage(msg);
 
     // Pop front the reacting answer:
-    a_reactingAnswers.nextMessage(code);
+    my_node->getReactingAnswers()->nextMessage(code);
     return;
   }
 
@@ -125,7 +125,7 @@ throw(anna::RuntimeException) {
       // Detailed log:
       if(my_node->logEnabled()) {
         anna::diameter::comm::ServerSession *usedServerSession = localServer->getLastUsedResource();
-        std::string detail = usedServerSession ? usedServerSession->asString() : "<null server session>"; // esto no deberia ocurrir
+        std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // esto no deberia ocurrir
         my_node->writeLogFile(message, (success ? "fwd2c" : "fwd2cError"), detail);
       }
     } catch(anna::RuntimeException &ex) {
@@ -137,8 +137,8 @@ throw(anna::RuntimeException) {
   anna::testing::TestManager::instantiate().receiveDiameterMessage(message, clientSession);
 }
 
-void MyDiameterEntity::eventResponse(const anna::diameter::comm::Response &response)
-throw(anna::RuntimeException) {
+void MyDiameterEntity::eventResponse(const anna::diameter::comm::Response &response, const anna::diameter::comm::OriginHost *myNode)
+noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventResponse", ANNA_FILE_LOCATION));
   Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());
   anna::diameter::comm::OriginHost *my_node = my_app.getOriginHost(getEngine()->getOriginHostName());
@@ -208,7 +208,7 @@ throw(anna::RuntimeException) {
 
         // Detailed log:
         anna::diameter::comm::ServerSession *usedServerSession = my_node->getCommEngine()->findServerSession(request->getRequestServerSessionKey());
-        std::string detail = usedServerSession ? usedServerSession->asString() : "<null server session>"; // esto no deberia ocurrir
+        std::string detail = usedServerSession ? usedServerSession->asString() : "[null server session]"; // esto no deberia ocurrir
 
         if(my_node->logEnabled()) {
           my_node->writeLogFile(*message, (success ? "fwd2c" : "fwd2cError"), detail);
@@ -230,8 +230,8 @@ throw(anna::RuntimeException) {
   if(isOK) anna::testing::TestManager::instantiate().receiveDiameterMessage(*message, clientSession);
 }
 
-void MyDiameterEntity::eventUnknownResponse(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message)
-throw(anna::RuntimeException) {
+void MyDiameterEntity::eventUnknownResponse(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message, const anna::diameter::comm::OriginHost *myNode)
+noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventUnknownResponse", ANNA_FILE_LOCATION));
   // Performance stats:
   Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());
@@ -253,8 +253,8 @@ throw(anna::RuntimeException) {
   if(my_node->logEnabled()) my_node->writeLogFile(message, "recvfe-ans-unknown", clientSession->asString());
 }
 
-void MyDiameterEntity::eventDPA(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message)
-throw(anna::RuntimeException) {
+void MyDiameterEntity::eventDPA(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message, const anna::diameter::comm::OriginHost *myNode)
+noexcept(false) {
   LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventDPA", ANNA_FILE_LOCATION));
   // Performance stats:
   Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());