Improvements & fixes
[anna.git] / example / diameter / launcher / main.cpp
index 033070b..54fcbdc 100644 (file)
@@ -363,6 +363,14 @@ bool Launcher::getDataBlockFromHexFile(const std::string &pathfile, anna::DataBl
   if(infile.is_open()) {
     infile >> buffer;
     std::string hexString(buffer, strlen(buffer));
+    // Allow colon separator in hex string: we have to remove them before processing with 'fromHexString':
+    hexString.erase(std::remove(hexString.begin(), hexString.end(), ':'), hexString.end());
+    LOGDEBUG(
+      std::string msg = "Hex string (remove colons if exists): ";
+      msg += hexString;
+      anna::Logger::debug(msg, ANNA_FILE_LOCATION);
+    );
+
     anna::functions::fromHexString(hexString, db);
     // Close file
     infile.close();
@@ -452,7 +460,7 @@ int Launcher::pushBurst(int loadAmount) throw() {
    }
 
    a_burstActive = true;
-   register int count;
+   int count;
 
    for (count = 0; count < loadAmount; count++)
       if (!sendBurstMessage()) break;
@@ -476,7 +484,7 @@ int Launcher::sendBurst(int loadAmount) throw() {
       return -2;
    }
 
-   register int count;
+   int count;
 
    for (count = 0; count < loadAmount; count++)
       if (!sendBurstMessage(true /* anyway */)) break;
@@ -517,7 +525,7 @@ bool Launcher::sendBurstMessage(bool anyway) throw() {
          if (a_burstRepeat) {
             a_burstCycle++;
 
-            if (burstLogEnabled()) writeBurstLogFile(anna::functions::asString(("\nCompleted burst cycle. Starting again (repeat mode) on cycle %d.\n", a_burstCycle)));
+            if (burstLogEnabled()) writeBurstLogFile(anna::functions::asString("\nCompleted burst cycle. Starting again (repeat mode) on cycle %d.\n", a_burstCycle));
          } else {
             if (burstLogEnabled()) writeBurstLogFile("\nCompleted burst cycle. Burst finished (repeat mode disabled).\n");
 
@@ -1466,8 +1474,8 @@ throw(anna::RuntimeException) {
      std::string address;
      int port;
      anna::functions::getAddressAndPortFromSocketLiteral(cl.getValue("httpServer"), address, port);
-     //const anna::comm::Device* device = network.find(Device::asAddress(address)); // aqui hay que proporcionar una IP !
-     const anna::comm::Device* device = *((network.resolve(address)->device_begin())); // ArtimaƱa para resolver (IP o hostname)
+     //const anna::comm::Device* device = network.find(Device::asAddress(address)); // here provide IP
+     const anna::comm::Device* device = *((network.resolve(address)->device_begin())); // trick to solve 
      a_httpServerSocket = new anna::comm::ServerSocket(anna::comm::INetAddress(device, port), cl.exists("httpServerShared") /* shared bind */, &anna::http::Transport::getFactory());
    }