result += "\n has been logged)";
result += "\n [recvfe-ans-unknown] Reception from entity of an unknown answer (probably former [req2e-expired]";
result += "\n has been logged)";
+ result += "\n [retry] Request retransmission";
result += "\n";
result += "\n-------------------------------------------------------------------------------------------- Load tests";
result += "\n";
if(!entity) throw anna::RuntimeException("No entity configured to send the message", ANNA_FILE_LOCATION);
anna::diameter::comm::Message *msg = createCommMessage();
-//xxxxxxxxxxxxx
- msg->setRetries(4);
- msg->setOnExpiry(anna::diameter::comm::Message::OnExpiry::Retransmit);
+ //msg->setRetries(4);
+ //msg->setOnExpiry(anna::diameter::comm::Message::OnExpiry::Retransmit);
if((opType == "sendxml") || (opType == "sendxml2e")) {
codecMsg.loadXML(param1);
#include "Launcher.hpp"
+void MyDiameterEntity::eventRequestRetransmission(const anna::diameter::comm::ClientSession* clientSession, anna::diameter::comm::Message *request) throw() {
+
+ LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventRequestRetransmission", ANNA_FILE_LOCATION));
+
+ // Base class:
+ Entity::eventRequestRetransmission(clientSession, request); // warning trace
+
+ // Performance stats:
+ Launcher& my_app = static_cast <Launcher&>(anna::app::functions::getApp());
+ CommandLine& cl(anna::CommandLine::instantiate());
+ // CommandId:
+ anna::diameter::CommandId cid = anna::diameter::codec::functions::getCommandId(request->getBody());
+ LOGDEBUG
+ (
+ std::string msg = "Request retransmitted: ";
+ msg += anna::diameter::functions::commandIdAsPairString(cid);
+ msg += " | DiameterServer: ";
+ msg += anna::functions::socketLiteralAsString(clientSession->getAddress(), clientSession->getPort());
+ msg += " | EventTime: ";
+ msg += anna::time::functions::currentTimeAsString();
+ anna::Logger::debug(msg, ANNA_FILE_LOCATION);
+ );
+
+ // Write retransmission
+ if(my_app.logEnabled()) my_app.writeLogFile(request->getBody(), "retry", clientSession->asString(), a_codecEngine);
+}
+
+
void MyDiameterEntity::eventRequest(anna::diameter::comm::ClientSession *clientSession, const anna::DataBlock &message)
throw(anna::RuntimeException) {
LOGMETHOD(anna::TraceMethod tm("launcher::MyDiameterEntity", "eventRequest", ANNA_FILE_LOCATION));
anna::diameter::codec::Engine * a_codecEngine; // for automatic answers (failed-avp), write logs, etc.
+ void eventRequestRetransmission(const anna::diameter::comm::ClientSession *, anna::diameter::comm::Message*) throw();
void eventResponse(const anna::diameter::comm::Response&) throw(anna::RuntimeException);
void eventRequest(anna::diameter::comm::ClientSession *, const anna::DataBlock&) throw(anna::RuntimeException);
void eventUnknownResponse(anna::diameter::comm::ClientSession *, const anna::DataBlock&) throw(anna::RuntimeException);
anna::diameter::helpers::base::functions::decodeSessionId(sid, diameterIdentity, high, low /* context-teid */, optional);
return (low % maxClientSessions);
}
- //case anna::diameter::helpers::dcca::ChargingContext::SMS:
- //case anna::diameter::helpers::dcca::ChargingContext::MMS:
- //default:
- // return -1; // IEC model and Unknown traffic types
+ case anna::diameter::helpers::dcca::ChargingContext::SMS:
+ case anna::diameter::helpers::dcca::ChargingContext::MMS:
+ case anna::diameter::helpers::dcca::ChargingContext::Unknown:
+ default:
+ return -1; // IEC model and Unknown traffic types
}
} catch(anna::RuntimeException &ex) {
LOGDEBUG(
void Entity::eventRequestRetransmission(const ClientSession* clientSession, Message *request) throw() {
LOGWARNING(
std::string msg(clientSession->asString());
- msg += " | eventRequestRetransmission";
+
+ HopByHop hopByHop = codec::functions::getHopByHop(request->getBody()); // context identification
+ int retries = request->getRetries();
+
+ msg += anna::functions::asString(" | eventRequestRetransmission: request with application HopByHop: %u; remaining %d retries", hopByHop, retries);
anna::Logger::warning(msg, ANNA_FILE_LOCATION);
);
}
bool doUnbind = false;
bool doRetransmission = false;
- // Quitar el OnExpiry: no tiene sentido habiendo keep-alive (DWR)
if(response->getClassCode() != ClassCode::Bind) {
if(response->getRequest()->getOnExpiry() == Message::OnExpiry::Abandon) {
a_onDisconnect = OnDisconnect::IgnorePendings; // Abandon is not graceful
if(doRetransmission) {
diameter::comm::Message *request = const_cast<Message*>(response->getRequest());
- eventRequestRetransmission(request);
-
int retries = request->getRetries();
if (retries > 0) {
retries--;
request->setRetries(retries);
LOGDEBUG
(
- //std::string msg(asString());
- std::string msg = anna::functions::asString("Retransmission initiated for request with HopByHop: %u; remaining %d retries", response->getHopByHop(), retries);
+ std::string msg(asString());
+ msg += anna::functions::asString(" | Retransmission initiated for request with HopByHop: %u; remaining %d retries", response->getHopByHop(), retries);
anna::Logger::debug(msg, ANNA_FILE_LOCATION);
);
diameter::codec::functions::setPotentiallyReTransmittedMessageBit(*request);
+ eventRequestRetransmission(request);
send(request);
}
}