mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-01 10:46:23 -04:00
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:
parent
41aa675a9b
commit
329050a9c2
223 changed files with 930 additions and 911 deletions
|
@ -101,8 +101,8 @@ int p3GxsTunnelService::tick()
|
|||
{
|
||||
|
||||
#ifdef DEBUG_GXS_TUNNEL
|
||||
time_t now = time(NULL);
|
||||
static time_t last_dump = 0;
|
||||
rstime_t now = time(NULL);
|
||||
static rstime_t last_dump = 0;
|
||||
|
||||
if(now > last_dump + INTERVAL_BETWEEN_DEBUG_DUMP )
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ void p3GxsTunnelService::flush()
|
|||
{
|
||||
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<uint64_t, GxsTunnelData>::iterator it = pendingGxsTunnelDataItems.begin();it != pendingGxsTunnelDataItems.end();++it)
|
||||
if(now > RS_GXS_TUNNEL_DELAY_BETWEEN_RESEND + it->second.last_sending_attempt)
|
||||
|
@ -194,7 +194,7 @@ void p3GxsTunnelService::flush()
|
|||
|
||||
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::iterator it(_gxs_tunnel_contacts.begin());it!=_gxs_tunnel_contacts.end();)
|
||||
{
|
||||
|
@ -256,13 +256,13 @@ void p3GxsTunnelService::flush()
|
|||
|
||||
// clean old received data prints.
|
||||
|
||||
for(std::map<uint64_t,time_t>::iterator it2=it->second.received_data_prints.begin();it2!=it->second.received_data_prints.end();)
|
||||
for(std::map<uint64_t,rstime_t>::iterator it2=it->second.received_data_prints.begin();it2!=it->second.received_data_prints.end();)
|
||||
if(now > it2->second + RS_GXS_TUNNEL_DATA_PRINT_STORAGE_DELAY)
|
||||
{
|
||||
#ifdef DEBUG_GXS_TUNNEL
|
||||
std::cerr << "(II) erasing old data print for message #" << it2->first << " in tunnel " << it->first << std::endl;
|
||||
#endif
|
||||
std::map<uint64_t,time_t>::iterator tmp(it2) ;
|
||||
std::map<uint64_t,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.received_data_prints.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
|
@ -1445,7 +1445,7 @@ void p3GxsTunnelService::startClientGxsTunnelConnection(const RsGxsId& to_gxs_id
|
|||
|
||||
GxsTunnelPeerInfo info ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
info.last_contact = now ;
|
||||
info.last_keep_alive_sent = now ;
|
||||
|
@ -1639,7 +1639,7 @@ void p3GxsTunnelService::debug_dump()
|
|||
{
|
||||
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::cerr << "p3GxsTunnelService::debug_dump()" << std::endl;
|
||||
std::cerr << " Registered client services: " << std::endl;
|
||||
|
|
|
@ -157,8 +157,8 @@ private:
|
|||
total_received = 0 ;
|
||||
}
|
||||
|
||||
time_t last_contact ; // used to keep track of working connexion
|
||||
time_t last_keep_alive_sent ; // last time we sent a keep alive packet.
|
||||
rstime_t last_contact ; // used to keep track of working connexion
|
||||
rstime_t last_keep_alive_sent ; // last time we sent a keep alive packet.
|
||||
|
||||
unsigned char aes_key[GXS_TUNNEL_AES_KEY_SIZE] ;
|
||||
|
||||
|
@ -169,7 +169,7 @@ private:
|
|||
RsTurtleGenericTunnelItem::Direction direction ; // specifiec wether we are client(managing the tunnel) or server.
|
||||
TurtleFileHash hash ; // hash that is last used. This is necessary for handling tunnel establishment
|
||||
std::set<uint32_t> client_services ;// services that used this tunnel
|
||||
std::map<uint64_t,time_t> received_data_prints ; // list of recently received messages, to avoid duplicates. Kept for 20 mins at most.
|
||||
std::map<uint64_t,rstime_t> received_data_prints ; // list of recently received messages, to avoid duplicates. Kept for 20 mins at most.
|
||||
uint32_t total_sent ;
|
||||
uint32_t total_received ;
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ private:
|
|||
struct GxsTunnelData
|
||||
{
|
||||
RsGxsTunnelDataItem *data_item ;
|
||||
time_t last_sending_attempt ;
|
||||
rstime_t last_sending_attempt ;
|
||||
};
|
||||
|
||||
// This maps contains the current peers to talk to with distant chat.
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue