Dynamic libraries could share the objects doing double free corruption on app stop.
Launcher app;
anna::http::functions::initialize();
+ std::cout << "XXXXXXXXXXXXXXXXXXXXXXX " << anna::functions::hash("hola que tal") << std::endl;
+
try {
anna::CommandLine& commandLine(anna::CommandLine::instantiate());
// General
*/
static S64 hash(const std::string& str) throw() { return hash(str.c_str()); }
- /**
- Calcula la funcion hash exclusive de la cadena recibida como parametro.
- \param str Cadena a la que aplicar la funcion hash exclusiva.
- */
- static unsigned long exclusiveHash(const std::string& str) throw() { return st_stringExclusiveHash.calcule(str); }
-
- /**
- Calcula la funcion hash exclusive de la cadena recibida como parametro.
- \param str Cadena a la que aplicar la funcion hash exclusiva.
- */
- static unsigned long exclusiveHash(const char* str) throw() { return st_stringExclusiveHash.calcule(std::string(str)); }
-
/**
Devuelve la cadena que contiene el resultado de aplicar la especificacion \em format
sobre el resto de los parametros.
return functions::componentByName<T> (T::getClassName(), fromFile, fromLine);
}
-
- /**
- * Gets exclusive hash for string provided on integer range
- *
- * @param str String hashed
- *
- * @return Hash unique value
- */
- static int exclusiveHashInt(const std::string& str) throw() { return st_string2intExclusiveHash.calcule(str); }
-
- /**
- * Gets exclusive hash for string (char pointer) provided on integer range
- *
- * @param str String hashed
- *
- * @return Hash unique value
- */
- static int exclusiveHashInt(const char* str) throw() { return st_string2intExclusiveHash.calcule(std::string(str)); }
-
/**
Finds string at the end of another
* @param target Isup number octet string.
*/
static void codeIsupNumber(const isup_number_t & isupNumber, bool calledOrCalling, std::string & target) throw(RuntimeException);
-
-private:
- static ExclusiveHash <std::string> st_stringExclusiveHash;
- static ExclusiveHash <std::string, int> st_string2intExclusiveHash;
};
}
// CLIENT FUNCTIONALITY //
//////////////////////////
- //typedef int clientSession_key; // exclusiveHash('ADDR:PORT|id')
typedef std::string clientSession_key; // 'ADDR:PORT|id'
typedef std::map <clientSession_key, ClientSession*> clientSession_container;
typedef clientSession_container::value_type clientSession_value_type;
const_server_iterator server_end() const throw() { return a_servers.end(); }
static const Server* server(const_server_iterator ii) throw() { return ii->second; }
- //typedef int entity_key; // exclusiveHash('IP1:PORT1 IP2:PORT2 IP3:PORT3 ...')
typedef std::string entity_key; // 'ADDR1:PORT1 ADDR2:PORT2 ADDR3:PORT3 ...'
entity_key getEntityKey(const socket_v &) const throw();
entity_key getEntityKey(const std::string & addr1, int port1, const std::string & addr2, int port2) const throw();
#define PAGE_WIDTH_LENGTH 80
-ExclusiveHash <std::string> functions::st_stringExclusiveHash;
-ExclusiveHash <std::string, int> functions::st_string2intExclusiveHash;
-
string functions::getVersion() throw() {
static const int version = ANNA_VERSION;
string result;
result->setWatchdogPeriod(a_watchdogPeriod);
result->a_parent = server;
result->a_socketId = socketId;
- result->initializeSequences(); // despu�s de asignar el server y el socketId (*)
- // (*) Las secuencias se basan en la semilla: srand(::time(NULL) + anna::functions::exclusiveHash(anna::functions::asString("%s:%d|%d", getAddress().c_str(), getPort(), a_socketId)));
+ result->initializeSequences(); // despues de asignar el server y el socketId (sequences are seed-based by mean exclusive hash)
result->a_engine = this;
clientSession_key key = ClientSession::getKey(server->getAddress(), server->getPort(), socketId);
a_clientSessions.insert(clientSession_value_type(key, result));
}
result.erase(result.size() - 1, 1); // remove last space
- //return anna::functions::exclusiveHash(result);
return result;
}
LocalServer::serverSession_key LocalServer::getServerSessionKey(const anna::comm::ClientSocket &clientSocket) const throw() {
- return (anna::functions::exclusiveHash(clientSocket.getRemoteAccessPoint().getINetAddress().serialize()));
+ return (anna::functions::hash(clientSocket.getRemoteAccessPoint().getINetAddress().serialize().c_str()));
}
result->setClientSocket((anna::comm::ClientSocket*)(&clientSocket));
result->a_parent = this;
result->a_socketId = key; // de momento...
- result->initializeSequences(); // despu�s de asignar el LocalServer y el socketId (*)
- // (*) Las secuencias se basan en la semilla: srand(::time(NULL) + anna::functions::exclusiveHash(anna::functions::asString("%s:%d|%d", getAddress().c_str(), getPort(), a_socketId)));
+ result->initializeSequences(); // despues de asignar el LocalServer y el socketId (sequences are seed-based by mean exclusive hash)
result->a_engine = a_engine;
a_serverSessions.insert(serverSession_value_type(key, result));
newConnection();
// affect any state that was set when the original request was
// processed. Duplicate answer messages that are to be locally
// consumed (see Section 6.2) SHOULD be silently discarded.
- srand(::time(NULL) + anna::functions::exclusiveHash(anna::functions::asString("%s:%d|%d", getAddress().c_str(), getPort(), a_socketId)));
+ srand(::time(NULL) + anna::functions::hash(anna::functions::asString("%s:%d|%d", getAddress().c_str(), getPort(), a_socketId).c_str()));
a_nextHopByHop = rand();
a_nextEndToEnd = ((::time(NULL) & 0xFFF) << 20) + (rand() & 0xFFFFF);
}