Use safer rstime_t instead of time_t

Avoid problems to serialization on different platforms, without breaking
nested STL containers serialization.

The conversion have been made with sed, and checked with grep, plus
kdiff3 visual ispection, plus rutime tests, so it should be fine.
This commit is contained in:
Gioacchino Mazzurco 2018-10-07 01:34:05 +02:00
parent 41aa675a9b
commit 329050a9c2
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
223 changed files with 930 additions and 911 deletions

View file

@ -36,10 +36,10 @@
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <time.h>
#include "util/rstime.h"
const time_t MAX_TIME_BEFORE_RETRY = 300 ; /* seconds before retrying an ip address */
const time_t MAX_KEEP_DNS_ENTRY = 3600 ; /* seconds during which a DNS entry is considered valid */
const rstime_t MAX_TIME_BEFORE_RETRY = 300 ; /* seconds before retrying an ip address */
const rstime_t MAX_KEEP_DNS_ENTRY = 3600 ; /* seconds during which a DNS entry is considered valid */
static const std::string ADDR_AGENT = "Mozilla/5.0";
@ -51,7 +51,7 @@ void *solveDNSEntries(void *p)
while(more_to_go)
{
// get an address request
time_t now = time(NULL) ;
rstime_t now = time(NULL) ;
more_to_go = false ;
std::string next_call = "" ;
@ -152,7 +152,7 @@ bool DNSResolver::getIPAddressFromString(const std::string& server_name,struct s
RsStackMutex mut(_rdnsMtx) ;
std::map<std::string, AddrInfo>::iterator it(_addr_map->find(server_name)) ;
time_t now = time(NULL) ;
rstime_t now = time(NULL) ;
AddrInfo *addr_info ;
if(it != _addr_map->end())