Property changes on: . ___________________________________________________________________ Added: svn:ignore + external Index: nel/include/nel/misc/common.h =================================================================== --- nel/include/nel/misc/common.h (revision 817) +++ nel/include/nel/misc/common.h (working copy) @@ -322,11 +322,11 @@ uint32 humanReadableToBytes (const std::string &str); /// Convert a time into a string that is easily readable by an human, for example 3600 -> "1h" -std::string secondsToHumanReadable (uint32 time); +std::string secondsToHumanReadable (time_t time); /// Get a bytes or time in string format and convert it in seconds or bytes -uint32 fromHumanReadable (const std::string &str); +time_t fromHumanReadable (const std::string &str); /// This function executes a program in the background and returns instantly (used for example to launch services in AES). Index: nel/include/nel/misc/time_nl.h =================================================================== --- nel/include/nel/misc/time_nl.h (revision 817) +++ nel/include/nel/misc/time_nl.h (working copy) @@ -62,7 +62,7 @@ * daylight saving if applicable. * This values is the same on all computer if computers are synchronized (with NTP for example). */ - static uint32 getSecondsSince1970 (); + static time_t getSecondsSince1970 (); /** Return the number of second since midnight (00:00:00), January 1, 1970, * coordinated universal time, according to the system clock. Index: nel/include/nel/net/admin.h =================================================================== --- nel/include/nel/net/admin.h (revision 817) +++ nel/include/nel/net/admin.h (working copy) @@ -58,7 +58,7 @@ std::string Name; // variable name int Update; // delta time in second when we have to check variable - uint32 LastUpdate; // in second + time_t LastUpdate; // in second }; typedef void (*TRemoteClientCallback) (uint32 rid, const std::string &cmd, const std::string &entityNames); Index: nel/include/nel/net/service.h =================================================================== --- nel/include/nel/net/service.h (revision 817) +++ nel/include/nel/net/service.h (working copy) @@ -237,7 +237,7 @@ sint getExitStatus () const { return _ExitStatus; } /// Returns the date of launch of the service. Unit: see CTime::getSecondsSince1970() - uint32 getLaunchingDate () const; + time_t getLaunchingDate () const; /// Return true if this service don't use the NS (naming service) bool getDontUseNS() const { return _DontUseNS; }; Index: nel/src/misc/common.cpp =================================================================== --- nel/src/misc/common.cpp (revision 817) +++ nel/src/misc/common.cpp (working copy) @@ -395,13 +395,13 @@ } -string secondsToHumanReadable (uint32 time) +string secondsToHumanReadable (time_t time) { static const char *divTable[] = { "s", "mn", "h", "d" }; static uint divCoef[] = { 60, 60, 24 }; uint div = 0; - uint32 res = time; - uint32 newres = res; + time_t res = time; + time_t newres = res; for(;;) { if(div > 2) @@ -418,12 +418,12 @@ return toString ("%u%s", res, divTable[div]); } -uint32 fromHumanReadable (const std::string &str) +time_t fromHumanReadable (const std::string &str) { if (str.size() == 0) return 0; - uint32 val; + time_t val; fromString(str, val); switch (str[str.size()-1]) @@ -451,7 +451,7 @@ if (args.size() != 1) return false; - uint32 seconds; + time_t seconds; fromString(args[0], seconds); log.displayNL("%s -> %s", args[0].c_str(), secondsToHumanReadable(seconds).c_str()); Index: nel/src/misc/time_nl.cpp =================================================================== --- nel/src/misc/time_nl.cpp (revision 817) +++ nel/src/misc/time_nl.cpp (working copy) @@ -48,9 +48,9 @@ * coordinated universal time, according to the system clock. * This values is the same on all computer if computers are synchronized (with NTP for example). */ -uint32 CTime::getSecondsSince1970 () +time_t CTime::getSecondsSince1970 () { - return uint32(time(NULL)); + return time_t(time(NULL)); } /** Return the number of second since midnight (00:00:00), January 1, 1970, Index: nel/src/net/admin.cpp =================================================================== --- nel/src/net/admin.cpp (revision 817) +++ nel/src/net/admin.cpp (working copy) @@ -68,7 +68,7 @@ uint NbWaiting; uint32 NbReceived; TServiceId SId; - uint32 Time; // when the request was ask + time_t Time; // when the request was ask TAdminViewResult Answers; }; @@ -304,7 +304,7 @@ static void cleanRequest () { - uint32 currentTime = CTime::getSecondsSince1970 (); + time_t currentTime = CTime::getSecondsSince1970 (); for (uint i = 0 ; i < Requests.size ();) { @@ -634,7 +634,7 @@ void updateAdmin() { - uint32 CurrentTime = CTime::getSecondsSince1970(); + time_t CurrentTime = CTime::getSecondsSince1970(); // @@ -648,7 +648,7 @@ // Check graph updates // - static uint32 lastGraphUpdateCheck = 0; + static time_t lastGraphUpdateCheck = 0; if (CurrentTime >= lastGraphUpdateCheck+1) { @@ -714,7 +714,7 @@ // Check alarms // - static uint32 lastAlarmsCheck = 0; + static time_t lastAlarmsCheck = 0; if (CurrentTime >= lastAlarmsCheck+AlarmCheckDelay) { Index: nel/src/net/login_server.cpp =================================================================== --- nel/src/net/login_server.cpp (revision 817) +++ nel/src/net/login_server.cpp (working copy) @@ -51,7 +51,7 @@ string UserExtended; // extended data (for free use) uint32 InstanceId; // the world instance in witch the user is awaited uint32 CharSlot; // the expected character slot, any other will be denied - uint32 Time; // when the cookie is inserted in pending list + time_t Time; // when the cookie is inserted in pending list }; static list PendingUsers; @@ -96,7 +96,7 @@ // delete too old cookie list::iterator it = PendingUsers.begin(); - uint32 Time = CTime::getSecondsSince1970(); + time_t Time = CTime::getSecondsSince1970(); while (it != PendingUsers.end ()) { if ((*it).Time < Time - TimeBeforeEraseCookie) Index: nel/src/net/module_gateway_transport.cpp =================================================================== --- nel/src/net/module_gateway_transport.cpp (revision 817) +++ nel/src/net/module_gateway_transport.cpp (working copy) @@ -56,7 +56,7 @@ TSockId SockId; /// Time stamp of last message received/emitted - mutable uint32 LastCommTime; + mutable time_t LastCommTime; CL3ServerRoute(IGatewayTransport *transport) @@ -115,7 +115,7 @@ if (_CallbackServer.get() != NULL) _CallbackServer->update2(100, 0); - uint32 now = CTime::getSecondsSince1970(); + time_t now = CTime::getSecondsSince1970(); // check each connected client for keep alive TRouteMap::iterator first(_Routes.begin()), last(_Routes.end()); for (; first != last; ++first) @@ -402,10 +402,10 @@ /// The Client callback mutable CCallbackClient CallbackClient; /// Time stamp of last message received/emitted - mutable uint32 LastCommTime; + mutable time_t LastCommTime; /// The last time we try to reconnect (in case of disconnection) - uint32 LastConnectionRetry; + time_t LastConnectionRetry; // conn id uint32 ConnId; @@ -521,7 +521,7 @@ // delete any route pending deletePendingRoute(); - uint32 now = CTime::getSecondsSince1970(); + time_t now = CTime::getSecondsSince1970(); // update the client connection TClientRoutes::iterator first(_Routes.begin()), last(_Routes.end()); for (; first != last; ++first) Index: nel/src/net/service.cpp =================================================================== --- nel/src/net/service.cpp (revision 817) +++ nel/src/net/service.cpp (working copy) @@ -140,7 +140,7 @@ //static CLog commandLog; static string CompilationDate; -static uint32 LaunchingDate; +static time_t LaunchingDate; static uint32 NbUserUpdate = 0; @@ -1705,7 +1705,7 @@ /* * Returns the date of launch of the service. Unit: see CTime::getSecondsSince1970() */ -uint32 IService::getLaunchingDate () const +time_t IService::getLaunchingDate () const { return LaunchingDate; } Index: nelns/admin_executor_service/admin_executor_service.cpp =================================================================== --- nelns/admin_executor_service/admin_executor_service.cpp (revision 823) +++ nelns/admin_executor_service/admin_executor_service.cpp (working copy) @@ -78,7 +78,7 @@ // // Namespaces // - + using namespace std; using namespace NLMISC; using namespace NLNET; @@ -100,7 +100,7 @@ uint NbWaiting; uint32 NbReceived; TServiceId SId; - uint32 Time; // when the request was ask + time_t Time; // when the request was ask TAdminViewResult Answers; }; @@ -122,7 +122,7 @@ uint32 PId; /// process Id used to kill the application bool Relaunch; /// if true, it means that the admin want to close and relaunch the service - uint32 LastPing; /// time in seconds of the last ping sent. If 0, means that the service already pong + time_t LastPing; /// time in seconds of the last ping sent. If 0, means that the service already pong vector WaitingRequestId; /// contains all request that the server hasn't reply yet @@ -197,7 +197,7 @@ vector RegisteredServices; -vector > WaitingToLaunchServices; // date and alias name +vector > WaitingToLaunchServices; // date and alias name vector AllAdminAlarms; // contains *all* alarms @@ -208,7 +208,7 @@ // Global Variables (scalars) // -uint32 LastPing = 0; // contains the date of the last ping sent to the services +time_t LastPing = 0; // contains the date of the last ping sent to the services // @@ -238,7 +238,7 @@ { char *text; NLMISC_CONVERT_VARGS(text, format, 4096); - + CMessage msgout("ADMIN_EMAIL"); string str = text; msgout.serial(str); @@ -420,10 +420,10 @@ // make sure the alias, command, etc were setup ok if (!ok) return false; nlinfo("Starting the service alias '%s'", alias.c_str()); - + bool dontLaunchServicesDirectly= IService::getInstance()->ConfigFile.exists("DontLaunchServicesDirectly")? IService::getInstance()->ConfigFile.getVar("DontLaunchServicesDirectly").asBool(): false; if (!dontLaunchServicesDirectly) - { + { // give the service alias to the service to forward it back when it will connected to the aes. arg += " -N"; arg += alias; @@ -431,7 +431,7 @@ // set the path for running arg += " -A"; arg += path; - + // suppress output to stdout #ifdef NL_OS_WINDOWS arg += " >NUL:"; @@ -441,11 +441,11 @@ // launch the service bool res = launchProgram(command, arg); - + // if launching ok, leave 1 second to the new launching service before lauching next one if (res) nlSleep(1000); - + return res; } else @@ -502,7 +502,7 @@ void checkWaitingServices() { - uint32 d = CTime::getSecondsSince1970(); + time_t d = CTime::getSecondsSince1970(); for(uint i = 0; i < WaitingToLaunchServices.size(); ) { @@ -520,11 +520,11 @@ static void checkPingPong() { - uint32 d = CTime::getSecondsSince1970(); + time_t d = CTime::getSecondsSince1970(); bool allPonged = true; bool haveService = false; - + for(uint i = 0; i < Services.size(); i++) { if(Services[i].Ready) @@ -682,7 +682,7 @@ Requests[i].NbReceived++; nldebug("REQUEST: ++ i %d rid %d NbWaiting %d NbReceived+ %d", i, Requests[i].Id, Requests[i].NbWaiting, Requests[i].NbReceived); - + return; } } @@ -692,7 +692,7 @@ void cleanRequests() { - uint32 currentTime = CTime::getSecondsSince1970(); + time_t currentTime = CTime::getSecondsSince1970(); // just a debug check for (uint t = 0 ; t < Requests.size(); t++) @@ -715,7 +715,7 @@ } } nlinfo("REQUEST: Waiting request %d: NbRef %d NbWaiting %d NbReceived %d", Requests[t].Id, NbRef, NbWaiting, NbReceived); - + if (NbRef != NbWaiting - NbReceived) { nlwarning("REQUEST: **** i %d rid %d -> NbRef(%d) != NbWaiting(%d) - NbReceived(%d) ", t, Requests[t].Id, NbRef, NbWaiting, NbReceived); @@ -731,7 +731,7 @@ TAdminViewVarNames varNames; TAdminViewValues values; - + varNames.push_back("service"); for (uint j = 0; j < Services.size(); j++) { @@ -748,7 +748,7 @@ else s = Services[j].AliasName; s += "-"+toString(Services[j].ServiceId); - s += "((TIMEOUT))"; + s += "((TIMEOUT))"; values.clear(); values.push_back(s); aesAddRequestAnswer(Requests[i].Id, varNames, values); @@ -798,7 +798,7 @@ } InfoLog->displayRawNL(""); InfoLog->displayRawNL("----------------------------------------------"); - } + } } else CUnifiedNetwork::getInstance()->send(Requests[i].SId, msgout); @@ -847,7 +847,7 @@ // not found in alias, try with short name for (sit = Services.begin(); sit != Services.end(); sit++) { - if ((*sit).ShortName == shortName) + if ((*sit).ShortName == shortName) { services.push_back(sit); } @@ -944,7 +944,7 @@ serviceGetView(rid, viewStr, answer); aesAddRequestAnswer(rid, answer); nlinfo("REQUEST: Treated view myself directly: '%s'", viewStr.c_str()); -} +} void treatRequestForOfflineService(uint32 rid, const string& serviceName, const string& viewStr) { @@ -954,11 +954,11 @@ TAdminViewVarNames varNames; TAdminViewValues values; - + // add default row varNames.push_back("service"); values.push_back(serviceName); - + for (uint k = 0; k < subvarpath.Destination.size(); k++) { size_t pos = subvarpath.Destination[k].first.find("="); @@ -1004,7 +1004,7 @@ aesAddRequestAnswer(rid, varNames, values); nlinfo("REQUEST: Sent and received view '%s' to offline service '%s'", viewStr.c_str(), serviceName.c_str()); } - + void addRequestForOnlineServices(uint32 rid, const string& viewStr) { // add services that I manage @@ -1018,7 +1018,7 @@ // add myself treatRequestOneself(rid,viewStr); -} +} void addRequestForAllServices(uint32 rid, const string& viewStr) { @@ -1039,7 +1039,7 @@ // add all running services (and for oneself) addRequestForOnlineServices(rid,viewStr); -} +} void addRequestForNamedService(uint32 rid, const string& service, const string& viewStr) { @@ -1074,7 +1074,7 @@ } } } -} +} void addRequest(uint32 rid, const string &rawvarpath, TServiceId sid) { @@ -1097,7 +1097,7 @@ for (uint t = 0; t < vp.Destination.size(); t++) { string service = vp.Destination[t].first; - + if (service == "*") { addRequestForOnlineServices(rid,varpath.Destination[i].second); @@ -1196,7 +1196,7 @@ // msgin.serialCont(AllAdminAlarms); msgin.serialCont(AllGraphUpdates); - + // set our own alarms for this service setInformations(AllAdminAlarms, AllGraphUpdates); @@ -1245,7 +1245,7 @@ { // receive an view answer from the service TServices::iterator sit = findService(sid); - + uint32 rid; msgin.serial(rid); @@ -1257,19 +1257,19 @@ { varNames.clear(); values.clear(); - + // adding default row - + uint32 i, nb; string var, val; - + msgin.serial(nb); for (i = 0; i < nb; i++) { msgin.serial(var); varNames.push_back(var); } - + msgin.serial(nb); for (i = 0; i < nb; i++) { @@ -1279,7 +1279,7 @@ answer.push_back(SAdminViewRow(varNames,values)); } aesAddRequestAnswer(rid, answer); - + // remove the waiting request for (uint i = 0; i < (*sit).WaitingRequestId.size();) { @@ -1497,7 +1497,7 @@ if (i != 0) cmd += " "; cmd += args[i]; } - + static uint32 requestId=0; addRequest(requestId++, cmd, TServiceId(0)); @@ -1539,14 +1539,14 @@ { if(args.size() <= 0) return false; - + string text; for (uint i =0; i < args.size(); i++) { text += args[i]+" "; } sendAdminEmail(text.c_str()); - + return true; } @@ -1623,13 +1623,13 @@ { if(args.size() <= 0) return false; - + string cmd; for (uint i =0; i < args.size(); i++) { cmd += args[i]+" "; } - + string path; #ifdef NL_OS_UNIX path = "/tmp/"; @@ -1637,13 +1637,13 @@ string fn = path+CFile::findNewFile("aessys.tmp"); string fne = path+CFile::findNewFile("aessyse.tmp"); - + cmd += " >" + fn + " 2>" + fne; - + log.displayNL("Executing: '%s' in directory '%s'", cmd.c_str(), CPath::getCurrentPath().c_str()); system(cmd.c_str()); - + char str[1024]; FILE *fp = fopen(fn.c_str(), "rt"); @@ -1656,14 +1656,14 @@ break; log.displayRaw(res); } - + fclose(fp); } else { log.displayNL("No stdout"); } - + fp = fopen(fne.c_str(), "rt"); if (fp != NULL) { @@ -1674,7 +1674,7 @@ break; log.displayRaw(res); } - + fclose(fp); } else @@ -1731,7 +1731,7 @@ } else log.displayNL( "Task is not running" ); - } + } return true; } Index: nelns/admin_service/admin_service.cpp =================================================================== --- nelns/admin_service/admin_service.cpp (revision 823) +++ nelns/admin_service/admin_service.cpp (working copy) @@ -103,8 +103,8 @@ uint NbWaiting; uint32 NbReceived; TSockId From; - uint32 Time; // when the request was ask - + time_t Time; // when the request was ask + uint32 NbRow; uint32 NbLines; @@ -203,7 +203,7 @@ for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++) if ((*aesit).SId == sid) break; - + if (asrt) nlassert (aesit != AdminExecutorServices.end()); return aesit; @@ -215,10 +215,10 @@ for (aesit = AdminExecutorServices.begin(); aesit != AdminExecutorServices.end(); aesit++) if ((*aesit).Name == name) break; - + if (asrt) nlassert (aesit != AdminExecutorServices.end()); - + return aesit; } @@ -236,36 +236,36 @@ char *query; NLMISC_CONVERT_VARGS (query, format, 1024); - + if (DatabaseConnection == 0) { nlwarning ("MYSQL: mysql_query (%s) failed: DatabaseConnection is 0", query); return NULL; } - + int ret = mysql_query (DatabaseConnection, query); if (ret != 0) { nlwarning ("MYSQL: mysql_query () failed for query '%s': %s", query, mysql_error(DatabaseConnection)); return 0; } - + sqlCurrentQueryResult = mysql_store_result(DatabaseConnection); if (sqlCurrentQueryResult == 0) { nlwarning ("MYSQL: mysql_store_result () failed for query '%s': %s", query, mysql_error(DatabaseConnection)); return 0; } - + MYSQL_ROW row = mysql_fetch_row(sqlCurrentQueryResult); if (row == 0) { nlwarning ("MYSQL: mysql_fetch_row () failed for query '%s': %s", query, mysql_error(DatabaseConnection)); } - + nldebug ("MYSQL: sqlQuery(%s) returns %d rows", query, mysql_num_rows(sqlCurrentQueryResult)); - - return row; + + return row; } MYSQL_ROW sqlNextRow () @@ -275,7 +275,7 @@ if (sqlCurrentQueryResult == 0) return 0; - + return mysql_fetch_row(sqlCurrentQueryResult); } @@ -297,7 +297,7 @@ // string Email; -uint32 FirstEmailTime = 0; +time_t FirstEmailTime = 0; void sendAdminAlert (const char *format, ...) { @@ -360,7 +360,7 @@ { subject = "Multiple problems"; } - + std::string from; if(IService::getInstance()->ConfigFile.exists("AdminEmailFrom")) from = IService::getInstance()->ConfigFile.getVar("AdminEmailFrom").asString(); @@ -404,18 +404,18 @@ msgin.serial (service, var, val); AESIT aesit = findAES (sid); - + string shard, server; shard = (*aesit).Shard; server = (*aesit).Name; - + if (!shard.empty() && !server.empty() && !service.empty() && !var.empty()) { string path = CPath::standardizePath (IService::getInstance()->ConfigFile.getVar("RRDVarPath").asString()); string rrdfilename = path + shard+"."+server+"."+service+"."+var+".rrd"; string arg; - + if (!NLMISC::CFile::fileExists(rrdfilename)) { MYSQL_ROW row = sqlQuery ("select graph_update from variable where path like '%%%s' and graph_update!=0", var.c_str()); @@ -541,7 +541,7 @@ void cleanRequest () { - uint32 currentTime = CTime::getSecondsSince1970 (); + time_t currentTime = CTime::getSecondsSince1970 (); bool timeout; @@ -560,7 +560,7 @@ { nlwarning ("REQUEST: Request %d timeouted, only %d on %d services have replied", Requests[i].Id, Requests[i].NbReceived, Requests[i].NbWaiting); } - + if (Requests[i].Log.empty()) { if (Requests[i].NbRow == 0 && timeout) @@ -682,7 +682,7 @@ vector informations; CMessage msgout("AES_INFO"); - + // // send services that should be running on this AES // @@ -713,7 +713,7 @@ } sqlFlushResult(); msgout.serialCont (informations); - + // // send graph update for services that should running on this AES // @@ -746,7 +746,7 @@ } sqlFlushResult(); msgout.serialCont (informations); - + nlinfo ("Sending all informations about %s AES-%hu (hostedservices, alarms,grapupdate)", (*aesit).Name.c_str(), (*aesit).SId.get()); CUnifiedNetwork::getInstance ()->send (sid, msgout); } @@ -802,11 +802,11 @@ } string shard = row[0]; sqlFlushResult(); - + AdminExecutorServices.push_back (CAdminExecutorService(shard, server, sid)); nlinfo ("%s-%hu, server name %s, for shard %s connected and added in the list", serviceName.c_str(), sid.get(), server.c_str(), shard.c_str()); - + // send him services that should run on this server sendAESInformations (sid); } @@ -863,7 +863,7 @@ AdminExecutorServices.push_back (CAdminExecutorService(shard, server, sid)); nlinfo ("%s-%hu, server name %s, for shard %s connected and added in the list", serviceName.c_str(), sid.get(), server.c_str(), shard.c_str()); - + // send him services that should run on this server sendAESInformations (sid); } @@ -1022,29 +1022,29 @@ else if (shard == "*" && server == "#") { // Select all shard all server including offline one - + MYSQL_ROW row = sqlQuery ("select distinct server, shard from service"); - + while (row != NULL) { AESIT aesit = findAES (row[0], false); - + if (aesit != AdminExecutorServices.end()) { addRequestWaitingNb (rid); (*aesit).WaitingRequestId.push_back (rid); - + CMessage msgout("AES_GET_VIEW"); msgout.serial (rid); msgout.serial (subvarpath.Destination[j].second); CUnifiedNetwork::getInstance ()->send ((*aesit).SId, msgout); nlinfo ("REQUEST: Sent view '%s' to shard name %s 'AES-%hu'", subvarpath.Destination[j].second.c_str(), (*aesit).Name.c_str(), (*aesit).SId.get()); - + } else if (server == "#") { vector vara, vala; - + // adding default row vara.push_back ("shard"); vala.push_back (row[1]); @@ -1054,10 +1054,10 @@ vara.push_back ("service"); vala.push_back ("AES"); - + vara.push_back ("State"); vala.push_back ("Offline"); - + addRequestAnswer (rid, vara, vala); } row = sqlNextRow (); @@ -1089,17 +1089,17 @@ else if (server == "#") { vector vara, vala; - + // adding default row vara.push_back ("shard"); vala.push_back (shard); vara.push_back ("server"); vala.push_back (row[0]); - + vara.push_back ("service"); vala.push_back ("AES"); - + vara.push_back ("State"); vala.push_back ("Offline"); @@ -1178,17 +1178,17 @@ varRequestTimeout (ConfigFile.getVar ("RequestTimeout")); ConfigFile.setCallback("RequestTimeout", &varRequestTimeout); - + varAdminAlertAccumlationTime (ConfigFile.getVar ("AdminAlertAccumlationTime")); ConfigFile.setCallback("AdmimAlertAccumlationTime", &varAdminAlertAccumlationTime); - + } bool update () { cleanRequest (); connectionWebUpdate (); - + updateSendAdminAlert (); return true; } @@ -1251,7 +1251,7 @@ NLMISC_COMMAND (generateAlert, "generate an alert", "") { if(args.size() != 1) return false; - + sendAdminAlert (args[0].c_str()); return true;