X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Fdiameter.comm%2FServerSession.cpp;h=ad0b15a26e776caa186756eaf94f45b909e50c52;hb=e80e62a5cf9aacad1a9551c68c432147ef98cd29;hp=3c493d0bd01b3b0603c74f15b37cb6c58db8d05f;hpb=3d71e5185fa9c93bde7363a668aecf96240ae2e9;p=anna.git diff --git a/source/diameter.comm/ServerSession.cpp b/source/diameter.comm/ServerSession.cpp index 3c493d0..ad0b15a 100644 --- a/source/diameter.comm/ServerSession.cpp +++ b/source/diameter.comm/ServerSession.cpp @@ -55,7 +55,7 @@ const anna::Millisecond ServerSession::DefaultAllowedInactivityTime(90000); // I ServerSession::ServerSession() : Session("diameter::comm::ServerSession", "Diameter Inactivity Detection Timer"), a_receiverFactory(this), a_cer(ClassCode::Bind), - a_dwr(ClassCode::ApplicationMessage) // realmente no es necesario, los Message son por defecto de aplicacion + a_dwr(ClassCode::ApplicationMessage) // not actually needed; Message is application type by default { initialize(); } void ServerSession::initialize() throw() { @@ -81,7 +81,6 @@ int ServerSession::getPort() const throw() { return a_parent->getKey().second; } - const Response* ServerSession::send(const Message* message) throw(anna::RuntimeException) { LOGMETHOD(anna::TraceMethod traceMethod(a_className, "send", ANNA_FILE_LOCATION)); @@ -215,11 +214,18 @@ const Response* ServerSession::send(const Message* message) throw(anna::RuntimeE // Trace non-application messages: LOGDEBUG( - if((cid == helpers::base::COMMANDID__Device_Watchdog_Request) || - (cid == helpers::base::COMMANDID__Disconnect_Peer_Request)) { - anna::Logger::debug("Sent DataBlock to XML representation:", ANNA_FILE_LOCATION); - try { anna::diameter::codec::Message msg; msg.decode(message->getBody()); /* decode to be traced */ } catch(anna::RuntimeException&) {;} - } + if( (cid == helpers::base::COMMANDID__Device_Watchdog_Request) || + (cid == helpers::base::COMMANDID__Disconnect_Peer_Request)) { + anna::Logger::debug("Sent DataBlock to XML representation:", ANNA_FILE_LOCATION); + try { + anna::diameter::codec::Message msg(a_engine->getBaseProtocolCodecEngine()); msg.decode(message->getBody()); /* decode to be traced */ + } + catch(anna::RuntimeException &ex) { + std::string msg = ex.getText(); + msg += " | Use diameter::comm::Engine::setBaseProtocolCodecEngine() to allow internal base protocol messages full tracing"; + anna::Logger::debug(msg, ANNA_FILE_LOCATION); + } + } ); // Restore sequences: @@ -306,6 +312,17 @@ void ServerSession::eventPeerShutdown() throw() { a_parent->eventPeerShutdown(this); } +void ServerSession::eventRequestRetransmission(Message *request) throw() { + + // OAM + OamModule &oamModule = OamModule::instantiate(); + oamModule.count(OamModule::Counter::RequestRetransmitted); + oamModule.count(OamModule::Counter::RequestRetransmittedOnServerSession); + + // Inform father server: + a_parent->eventRequestRetransmission(this, request); +} + void ServerSession::eventResponse(const Response& response) throw(anna::RuntimeException) { // Inform father server: a_parent->eventResponse(response); @@ -344,9 +361,18 @@ throw(anna::RuntimeException) { msg += anna::diameter::functions::commandIdAsPairString(cid); anna::Logger::debug(msg, ANNA_FILE_LOCATION); - if((cid == helpers::base::COMMANDID__Capabilities_Exchange_Request) || (cid.first == helpers::base::COMMANDID__Device_Watchdog_Request.first)) - try { anna::diameter::codec::Message dmsg; dmsg.decode(db); /* decode to be traced */ } catch(anna::RuntimeException&) {;} -); + if( (cid == helpers::base::COMMANDID__Capabilities_Exchange_Request) || + (cid.first == helpers::base::COMMANDID__Device_Watchdog_Request.first)) { + try { + anna::diameter::codec::Message dmsg(a_engine->getBaseProtocolCodecEngine()); dmsg.decode(db); /* decode to be traced */ + } + catch(anna::RuntimeException &ex) { + std::string msg = ex.getText(); + msg += " | Use diameter::comm::Engine::setBaseProtocolCodecEngine() to allow internal base protocol messages full tracing"; + anna::Logger::debug(msg, ANNA_FILE_LOCATION); + } + } + ); // Main counters: OamModule &oamModule = OamModule::instantiate(); oamModule.count(isRequest ? OamModule::Counter::RequestReceived : OamModule::Counter::AnswerReceived); @@ -371,6 +397,9 @@ throw(anna::RuntimeException) { } a_cer.setBody(db); + // Basic DRA: + getParent()->getEngine()->manageDrDhServerSession(this, true /* register */); + sendCEA(); //activateTimer(); // Ya se invoca al inicio de este metodo ::receive //bool changes = a_parent->refreshAvailability(); @@ -571,7 +600,7 @@ throw(anna::RuntimeException) { if(cea.isEmpty()) { LOGDEBUG(anna::Logger::debug("Empty CEA message. Remote client never will bound this connection at application level", ANNA_FILE_LOCATION)); - LOGWARNING(anna::Logger::warning("Discarding received CER without sending CEA (consider to send CEA with Result-Code DIAMETER_UNKNOWN_PEER)", ANNA_FILE_LOCATION)); + LOGWARNING(anna::Logger::warning("Discarding received CER: cannot send empty CEA (consider to send CEA with Result-Code DIAMETER_UNKNOWN_PEER)", ANNA_FILE_LOCATION)); return; }