mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Merge pull request #1364 from G10h4ck/safer_time
Use safer rstime_t instead of time_t
This commit is contained in:
commit
09b109d522
@ -78,7 +78,7 @@ win32 {
|
||||
QMAKE_CC = $${QMAKE_CXX}
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN
|
||||
# These have been replaced by _WIN32 && __MINGW32__
|
||||
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
|
||||
|
@ -132,8 +132,8 @@ public:
|
||||
SendLobbyParticipantsTask(RsIdentity* idservice, ChatHandler::LobbyParticipantsInfo pi):
|
||||
GxsResponseTask(idservice, 0), mParticipantsInfo(pi)
|
||||
{
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
requestGxsId(mit->first);
|
||||
}
|
||||
@ -144,8 +144,8 @@ protected:
|
||||
virtual void gxsDoWork(Request &/*req*/, Response &resp)
|
||||
{
|
||||
resp.mDataStream.getStreamToMember();
|
||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||
for(std::map<RsGxsId, time_t>::const_iterator mit = map.begin(); mit != map.end(); ++mit)
|
||||
const auto& map = mParticipantsInfo.participants;
|
||||
for(auto mit = map.begin(); mit != map.end(); ++mit)
|
||||
{
|
||||
StreamBase& stream = resp.mDataStream.getStreamToMember();
|
||||
double last_active = mit->second;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "StateTokenServer.h"
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
class RsPeers;
|
||||
class RsIdentity;
|
||||
@ -117,7 +118,7 @@ public:
|
||||
class LobbyParticipantsInfo{
|
||||
public:
|
||||
StateToken state_token;
|
||||
std::map<RsGxsId, time_t> participants;
|
||||
std::map<RsGxsId, rstime_t> participants;
|
||||
};
|
||||
|
||||
class ChatInfo{
|
||||
|
@ -521,7 +521,7 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
|
||||
StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages");
|
||||
usagesStream.getStreamToMember();
|
||||
|
||||
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
for(auto it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
|
||||
{
|
||||
usagesStream.getStreamToMember()
|
||||
<< makeKeyValue("usage_time", (uint32_t)data.mLastUsageTS)
|
||||
|
@ -40,16 +40,16 @@
|
||||
//#define DEBUG_CHAT_LOBBIES 1
|
||||
|
||||
static const int CONNECTION_CHALLENGE_MAX_COUNT = 20 ; // sends a connection challenge every 20 messages
|
||||
static const time_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const rstime_t CONNECTION_CHALLENGE_MAX_MSG_AGE = 30 ; // maximum age of a message to be used in a connection challenge
|
||||
static const int CONNECTION_CHALLENGE_MIN_DELAY = 15 ; // sends a connection at most every 15 seconds
|
||||
static const int LOBBY_CACHE_CLEANING_PERIOD = 10 ; // clean lobby caches every 10 secs (remove old messages)
|
||||
|
||||
static const time_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const time_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const time_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const time_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
static const rstime_t MAX_KEEP_MSG_RECORD = 1200 ; // keep msg record for 1200 secs max.
|
||||
static const rstime_t MAX_KEEP_INACTIVE_NICKNAME = 180 ; // keep inactive nicknames for 3 mn max.
|
||||
static const rstime_t MAX_DELAY_BETWEEN_LOBBY_KEEP_ALIVE = 120 ; // send keep alive packet every 2 minutes.
|
||||
static const rstime_t MAX_KEEP_PUBLIC_LOBBY_RECORD = 60 ; // keep inactive lobbies records for 60 secs max.
|
||||
static const rstime_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask for lobby list more than once every 30 secs.
|
||||
static const rstime_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
|
||||
|
||||
static const uint32_t MAX_ALLOWED_LOBBIES_IN_LIST_WARNING = 50 ;
|
||||
//static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
|
||||
@ -71,10 +71,10 @@ DistributedChatService::DistributedChatService(uint32_t serv_type,p3ServiceContr
|
||||
|
||||
void DistributedChatService::flush()
|
||||
{
|
||||
static time_t last_clean_time_lobby = 0 ;
|
||||
static time_t last_req_chat_lobby_list = 0 ;
|
||||
static rstime_t last_clean_time_lobby = 0 ;
|
||||
static rstime_t last_req_chat_lobby_list = 0 ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(last_clean_time_lobby + LOBBY_CACHE_CLEANING_PERIOD < now)
|
||||
{
|
||||
@ -117,19 +117,19 @@ bool DistributedChatService::handleRecvChatLobbyMsgItem(RsChatMsgItem *ci)
|
||||
if(cli == NULL)
|
||||
return true ; // the item is handled correctly if it's not a lobby item ;-)
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now+100 > (time_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) cli->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep plus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)cli->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return false ;
|
||||
}
|
||||
if(now+600 < (time_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
if(now+600 < (rstime_t) cli->sendTime) // the message is from the future. Drop it. more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)cli->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
cli->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -292,7 +292,7 @@ bool DistributedChatService::getVirtualPeerId(const ChatLobbyId& id,ChatLobbyVir
|
||||
void DistributedChatService::locked_printDebugInfo() const
|
||||
{
|
||||
std::cerr << "Recorded lobbies: " << std::endl;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for( std::map<ChatLobbyId,ChatLobbyEntry>::const_iterator it(_chat_lobbys.begin()) ;it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
@ -307,7 +307,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
std::cerr << " Last activity\t: " << now - it->second.last_activity << " seconds ago." << std::endl;
|
||||
std::cerr << " Cached messages\t: " << it->second.msg_cache.size() << std::endl;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
std::cerr << " " << std::hex << it2->first << std::dec << " time=" << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
std::cerr << " Participating friends: " << std::endl;
|
||||
@ -317,7 +317,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
std::cerr << " Participating nick names: " << std::endl;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
for(std::map<RsGxsId,rstime_t>::const_iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();++it2)
|
||||
std::cerr << " " << it2->first << ": " << now - it2->second << " secs ago" << std::endl;
|
||||
|
||||
}
|
||||
@ -339,7 +339,7 @@ void DistributedChatService::locked_printDebugInfo() const
|
||||
|
||||
bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObject *obj,const RsPeerId& peer_id,uint32_t lobby_count)
|
||||
{
|
||||
static std::map<std::string, std::list<time_t> > message_counts ;
|
||||
static std::map<std::string, std::list<rstime_t> > message_counts ;
|
||||
|
||||
std::ostringstream os ;
|
||||
os << obj->lobby_id ;
|
||||
@ -375,14 +375,14 @@ bool DistributedChatService::locked_bouncingObjectCheck(RsChatLobbyBouncingObjec
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "lobby_count=" << lobby_count << std::endl;
|
||||
std::cerr << "Got msg for peer " << pid << std::dec << ". Limit is " << max_cnt << ". List is " ;
|
||||
for(std::list<time_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
for(std::list<rstime_t>::const_iterator it(message_counts[pid].begin());it!=message_counts[pid].end();++it)
|
||||
std::cerr << *it << " " ;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::list<time_t>& lst = message_counts[pid] ;
|
||||
std::list<rstime_t>& lst = message_counts[pid] ;
|
||||
|
||||
// Clean old messages time stamps from the list.
|
||||
//
|
||||
@ -501,7 +501,7 @@ void DistributedChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
std::cerr << "Received chat lobby list from friend " << item->PeerId() << ", " << item->lobbies.size() << " elements." << std::endl;
|
||||
#endif
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -677,7 +677,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << "Received ChatLobbyEvent item of type " << (int)(item->event_type) << ", and string=" << item->string1 << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(rsReputations->overallReputationLevel(item->signature.keyId) == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
{
|
||||
@ -713,17 +713,17 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
}
|
||||
addTimeShiftStatistics((int)now - (int)item->sendTime) ;
|
||||
|
||||
if(now+100 > (time_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
if(now+100 > (rstime_t) item->sendTime + MAX_KEEP_MSG_RECORD) // the message is older than the max cache keep minus 100 seconds ! It's too old, and is going to make an echo!
|
||||
{
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (time_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received severely outdated lobby event item (" << now - (rstime_t)item->sendTime << " in the past)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
return ;
|
||||
}
|
||||
if(now+600 < (time_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
if(now+600 < (rstime_t) item->sendTime) // the message is from the future more than 10 minutes
|
||||
{
|
||||
std::cerr << "Received event item from the future (" << (time_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Received event item from the future (" << (rstime_t)item->sendTime - now << " seconds in the future)! Dropping it!" << std::endl;
|
||||
std::cerr << "Message item is:" << std::endl;
|
||||
item->print(std::cerr) ;
|
||||
std::cerr << std::endl;
|
||||
@ -751,7 +751,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *
|
||||
|
||||
if(it != _chat_lobbys.end())
|
||||
{
|
||||
std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.find(item->signature.keyId)) ;
|
||||
|
||||
if(it2 != it->second.gxs_ids.end())
|
||||
{
|
||||
@ -815,7 +815,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
visible_lobbies.push_back(it->second) ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now > MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ + last_visible_lobby_info_request_time)
|
||||
{
|
||||
@ -843,7 +843,7 @@ void DistributedChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatL
|
||||
//
|
||||
bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,const RsPeerId& peer_id)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
locked_printDebugInfo() ; // debug
|
||||
@ -874,7 +874,7 @@ bool DistributedChatService::bounceLobbyObject(RsChatLobbyBouncingObject *item,c
|
||||
|
||||
// Checks wether the msg is already recorded or not
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator it2(lobby.msg_cache.find(item->msg_id)) ;
|
||||
|
||||
if(it2 != lobby.msg_cache.end()) // found!
|
||||
{
|
||||
@ -1097,7 +1097,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
std::cerr << " Peer Id = " << item->PeerId() << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyId lobby_id ;
|
||||
const RsPeerId& ownId = rsPeers->getOwnId();
|
||||
|
||||
@ -1106,7 +1106,7 @@ void DistributedChatService::handleConnectionChallenge(RsChatLobbyConnectChallen
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it(_chat_lobbys.begin());it!=_chat_lobbys.end() && !found;++it)
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end() && !found;++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE + 5 > now) // any msg not older than 5 seconds plus max challenge count is fine.
|
||||
{
|
||||
uint64_t code = makeConnexionChallengeCode(ownId,it->first,it2->first) ;
|
||||
@ -1156,10 +1156,10 @@ void DistributedChatService::sendConnectionChallenge(ChatLobbyId lobby_id)
|
||||
return ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
ChatLobbyMsgId msg_id = 0 ;
|
||||
|
||||
for(std::map<ChatLobbyMsgId,time_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::const_iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();++it2)
|
||||
if(it2->second + CONNECTION_CHALLENGE_MAX_MSG_AGE > now) // any msg not older than 20 seconds is fine.
|
||||
{
|
||||
msg_id = it2->first ;
|
||||
@ -1431,7 +1431,7 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new Lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.participating_friends.insert(it->second.peer_id) ;
|
||||
@ -1555,7 +1555,7 @@ bool DistributedChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id,co
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " Creating new lobby entry." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
|
||||
@ -1604,7 +1604,7 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " New (unique) ID: " << std::hex << lobby_id << std::dec << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
ChatLobbyEntry entry ;
|
||||
entry.lobby_flags = lobby_flags ;
|
||||
@ -1859,20 +1859,20 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
{
|
||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 1 - clean cache of all lobbies and participating nicknames.
|
||||
//
|
||||
for(std::map<ChatLobbyId,ChatLobbyEntry>::iterator it = _chat_lobbys.begin();it!=_chat_lobbys.end();++it)
|
||||
{
|
||||
for(std::map<ChatLobbyMsgId,time_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
for(std::map<ChatLobbyMsgId,rstime_t>::iterator it2(it->second.msg_cache.begin());it2!=it->second.msg_cache.end();)
|
||||
if(it2->second + MAX_KEEP_MSG_RECORD < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing old msg 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<ChatLobbyMsgId,time_t>::iterator tmp(it2) ;
|
||||
std::map<ChatLobbyMsgId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.msg_cache.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
@ -1882,14 +1882,14 @@ void DistributedChatService::cleanLobbyCaches()
|
||||
|
||||
bool changed = false ;
|
||||
|
||||
for(std::map<RsGxsId,time_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
for(std::map<RsGxsId,rstime_t>::iterator it2(it->second.gxs_ids.begin());it2!=it->second.gxs_ids.end();)
|
||||
if(it2->second + MAX_KEEP_INACTIVE_NICKNAME < now)
|
||||
{
|
||||
#ifdef DEBUG_CHAT_LOBBIES
|
||||
std::cerr << " removing inactive nickname 0x" << std::hex << it2->first << ", time=" << std::dec << now - it2->second << " secs ago" << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<RsGxsId,time_t>::iterator tmp(it2) ;
|
||||
std::map<RsGxsId,rstime_t>::iterator tmp(it2) ;
|
||||
++tmp ;
|
||||
it->second.gxs_ids.erase(it2) ;
|
||||
it2 = tmp ;
|
||||
|
@ -135,11 +135,11 @@ class DistributedChatService
|
||||
class ChatLobbyEntry: public ChatLobbyInfo
|
||||
{
|
||||
public:
|
||||
std::map<ChatLobbyMsgId,time_t> msg_cache ;
|
||||
std::map<ChatLobbyMsgId,rstime_t> msg_cache ;
|
||||
RsPeerId virtual_peer_id ;
|
||||
int connexion_challenge_count ;
|
||||
time_t last_connexion_challenge_time ;
|
||||
time_t last_keep_alive_packet_time ;
|
||||
rstime_t last_connexion_challenge_time ;
|
||||
rstime_t last_keep_alive_packet_time ;
|
||||
std::set<RsPeerId> previously_known_peers ;
|
||||
};
|
||||
|
||||
@ -152,8 +152,8 @@ class DistributedChatService
|
||||
// RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE
|
||||
|
||||
float _time_shift_average ;
|
||||
time_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
time_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
rstime_t last_lobby_challenge_time ; // prevents bruteforce attack
|
||||
rstime_t last_visible_lobby_info_request_time ; // allows to ask for updates
|
||||
bool _should_reset_lobby_counts ;
|
||||
RsGxsId _default_identity;
|
||||
std::map<ChatLobbyId,RsGxsId> _lobby_default_identity;
|
||||
|
@ -521,12 +521,12 @@ class MsgCounter
|
||||
public:
|
||||
MsgCounter() {}
|
||||
|
||||
void clean(time_t max_time)
|
||||
void clean(rstime_t max_time)
|
||||
{
|
||||
while(!recv_times.empty() && recv_times.front() < max_time)
|
||||
recv_times.pop_front() ;
|
||||
}
|
||||
std::list<time_t> recv_times ;
|
||||
std::list<rstime_t> recv_times ;
|
||||
};
|
||||
|
||||
void p3ChatService::handleIncomingItem(RsItem *item)
|
||||
|
@ -21,7 +21,7 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
#include <vector>
|
||||
#include <xapian.h>
|
||||
|
||||
@ -261,7 +261,7 @@ private:
|
||||
return dbDir;
|
||||
}
|
||||
|
||||
static std::string timetToXapianDate(const time_t& time)
|
||||
static std::string timetToXapianDate(const rstime_t& time)
|
||||
{
|
||||
char date[] = "YYYYMMDD\0";
|
||||
std::strftime(date, 9, "%Y%m%d", std::gmtime(&time));
|
||||
|
@ -80,7 +80,7 @@
|
||||
PeerConnectStateBox::PeerConnectStateBox()
|
||||
{
|
||||
//mPeerId = id;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
mState = CSB_START;
|
||||
mNetState = CSB_NETSTATE_UNKNOWN;
|
||||
mStateTS = now;
|
||||
@ -241,7 +241,7 @@ void PeerConnectStateBox::stateMsg(std::ostream &out, std::string msg, uint32_t
|
||||
std::string PeerConnectStateBox::connectState() const
|
||||
{
|
||||
std::string str = StateAsString(mState);
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::string out;
|
||||
rs_sprintf(out, "%s(%lu/%lu) for %ld secs", str.c_str(), mNoAttempts, mNoFailedAttempts, now - mStateTS);
|
||||
if ( (mState == CSB_CONNECTED) || (mState == CSB_DIRECT_ATTEMPT) ||
|
||||
@ -358,7 +358,7 @@ uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, uint32_t netmode, uint3
|
||||
uint32_t PeerConnectStateBox::connectCb_direct()
|
||||
{
|
||||
uint32_t retval = 0;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -497,7 +497,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
|
||||
proxyPortMode = CSB_ACTION_DHT_PORT;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
@ -782,7 +782,7 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
|
||||
*/
|
||||
|
||||
/* DO Connect / Disconnect Updates ... very specific! */
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
switch(update)
|
||||
{
|
||||
case CSB_UPDATE_CONNECTED:
|
||||
@ -1035,7 +1035,7 @@ bool PeerConnectStateBox::storeProxyPortChoice(uint32_t flags, bool useProxyPort
|
||||
bool PeerConnectStateBox::getProxyPortChoice()
|
||||
{
|
||||
#ifdef DEBUG_CONNECTBOX
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::cerr << "PeerConnectStateBox::getProxyPortChoice() Using ConnectLogic Info from: ";
|
||||
std::cerr << now-mProxyPortTS << " ago. Flags: " << mProxyPortFlags;
|
||||
|
@ -72,7 +72,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
class PeerConnectStateBox
|
||||
@ -104,16 +104,16 @@ class PeerConnectStateBox
|
||||
|
||||
uint32_t mState;
|
||||
uint32_t mNetState;
|
||||
time_t mStateTS;
|
||||
rstime_t mStateTS;
|
||||
uint32_t mNoAttempts;
|
||||
uint32_t mNoFailedAttempts;
|
||||
time_t mNextAttemptTS;
|
||||
time_t mAttemptLength;
|
||||
rstime_t mNextAttemptTS;
|
||||
rstime_t mAttemptLength;
|
||||
|
||||
// ProxyPort Storage.
|
||||
uint32_t mProxyPortFlags;
|
||||
bool mProxyPortChoice;
|
||||
time_t mProxyPortTS;
|
||||
rstime_t mProxyPortTS;
|
||||
};
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DhtPeerDetails
|
||||
|
||||
/* direct from the DHT! */
|
||||
uint32_t mDhtState; // One of RSDHT_PEERDHT_[...]
|
||||
time_t mDhtUpdateTS;
|
||||
rstime_t mDhtUpdateTS;
|
||||
|
||||
/* internal state */
|
||||
PeerConnectStateBox mConnectLogic;
|
||||
@ -66,9 +66,9 @@ class DhtPeerDetails
|
||||
struct sockaddr_in mPeerConnectAddr;
|
||||
uint32_t mPeerConnectPoint;
|
||||
|
||||
time_t mPeerConnectUdpTS;
|
||||
time_t mPeerConnectTS;
|
||||
time_t mPeerConnectClosedTS;
|
||||
rstime_t mPeerConnectUdpTS;
|
||||
rstime_t mPeerConnectTS;
|
||||
rstime_t mPeerConnectClosedTS;
|
||||
|
||||
bool mExclusiveProxyLock;
|
||||
|
||||
@ -80,7 +80,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerReqState;
|
||||
uint32_t mPeerReqMode;
|
||||
bdId mPeerReqProxyId;
|
||||
time_t mPeerReqTS;
|
||||
rstime_t mPeerReqTS;
|
||||
|
||||
/* Callback Info */
|
||||
std::string mPeerCbMsg;
|
||||
@ -88,7 +88,7 @@ class DhtPeerDetails
|
||||
uint32_t mPeerCbPoint;
|
||||
bdId mPeerCbProxyId;
|
||||
bdId mPeerCbDestId;
|
||||
time_t mPeerCbTS;
|
||||
rstime_t mPeerCbTS;
|
||||
|
||||
};
|
||||
|
||||
@ -331,7 +331,7 @@ private:
|
||||
float mDhtReadRate;
|
||||
float mDhtWriteRate;
|
||||
|
||||
time_t mLastDataRateUpdate;
|
||||
rstime_t mLastDataRateUpdate;
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
@ -380,7 +380,7 @@ private:
|
||||
RsPeerId mOwnRsId;
|
||||
bdNodeId mOwnDhtId;
|
||||
|
||||
time_t mMinuteTS;
|
||||
rstime_t mMinuteTS;
|
||||
|
||||
/* translation maps */
|
||||
std::map<RsPeerId, bdNodeId> mTransToNodeId;
|
||||
|
@ -204,7 +204,7 @@ void p3BitDht::updateDataRates()
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********* LOCKED *********/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
float period = now - mLastDataRateUpdate;
|
||||
|
||||
#define RATE_FACTOR (0.75)
|
||||
@ -380,7 +380,7 @@ RsDhtRelayProxy::RsDhtRelayProxy()
|
||||
mCreateTS = 0;
|
||||
|
||||
//uint32_t mDataSize;
|
||||
//time_t mLastBandwidthTS;
|
||||
//rstime_t mLastBandwidthTS;
|
||||
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ int p3BitDht::PeerCallback(const bdId *id, uint32_t status)
|
||||
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
dpd->mDhtUpdateTS = now;
|
||||
|
||||
return 1;
|
||||
@ -510,7 +510,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
||||
*/
|
||||
|
||||
bdId peerId;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
switch(point)
|
||||
{
|
||||
@ -1101,7 +1101,7 @@ int p3BitDht::tick()
|
||||
minuteTick();
|
||||
|
||||
#ifdef DEBUG_PEERNET_COMMON
|
||||
time_t now = time(NULL);
|
||||
time_t now = time(NULL); // Don't use rstime_t here or ctime break on windows
|
||||
std::cerr << "p3BitDht::tick() TIME: " << ctime(&now) << std::endl;
|
||||
std::cerr.flush();
|
||||
#endif
|
||||
@ -1114,7 +1114,7 @@ int p3BitDht::tick()
|
||||
|
||||
int p3BitDht::minuteTick()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
int deltaT = 0;
|
||||
|
||||
{
|
||||
@ -1164,7 +1164,7 @@ int p3BitDht::doActions()
|
||||
std::cerr << "p3BitDht::doActions()" << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
while(mActions.size() > 0)
|
||||
{
|
||||
@ -1727,7 +1727,7 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
||||
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* check if they are in our friend list */
|
||||
DhtPeerDetails *dpd = findInternalDhtPeer_locked(&(peerId->id), RSDHT_PEERTYPE_FRIEND);
|
||||
@ -2171,7 +2171,7 @@ int p3BitDht::removeRelayConnection(const bdId *srcId, const bdId *destId)
|
||||
void p3BitDht::monitorConnections()
|
||||
{
|
||||
RsStackMutex stack(dhtMtx); /********** LOCKED MUTEX ***************/
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::map<bdNodeId, DhtPeerDetails>::iterator it;
|
||||
|
||||
|
@ -90,10 +90,10 @@ Classes
|
||||
- std::string name
|
||||
- RsFileHash hash
|
||||
- uint64_t size
|
||||
- time_t Last modification time
|
||||
- rstime_t Last modification time
|
||||
|
||||
LocalFileInfo: public FileInfo
|
||||
- time_t Last data access time
|
||||
- rstime_t Last data access time
|
||||
- uint64_t Total data uploaded
|
||||
- uint32_t ShareFlags
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
@ -356,7 +356,7 @@ bool InternalFileHierarchyStorage::updateHash(const DirectoryStorage::EntryIndex
|
||||
|
||||
return true;
|
||||
}
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time)
|
||||
bool InternalFileHierarchyStorage::updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time)
|
||||
{
|
||||
if(!checkIndex(file_index,FileStorageNode::TYPE_FILE))
|
||||
{
|
||||
@ -427,7 +427,7 @@ DirectoryStorage::EntryIndex InternalFileHierarchyStorage::allocateNewIndex()
|
||||
return mNodes.size()-1 ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,time_t most_recent_time,time_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
bool InternalFileHierarchyStorage::updateDirEntry(const DirectoryStorage::EntryIndex& indx,const std::string& dir_name,rstime_t most_recent_time,rstime_t dir_modtime,const std::vector<RsFileHash>& subdirs_hash,const std::vector<FileEntry>& subfiles_array)
|
||||
{
|
||||
if(!checkIndex(indx,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -599,7 +599,7 @@ void InternalFileHierarchyStorage::getStatistics(SharedDirStats& stats) const
|
||||
stats.total_shared_size = mTotalSize ;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m) const
|
||||
bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m) const
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -614,7 +614,7 @@ bool InternalFileHierarchyStorage::getTS(const DirectoryStorage::EntryIndex& ind
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* m)
|
||||
bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* m)
|
||||
{
|
||||
if(!checkIndex(index,FileStorageNode::TYPE_DIR))
|
||||
{
|
||||
@ -631,11 +631,11 @@ bool InternalFileHierarchyStorage::setTS(const DirectoryStorage::EntryIndex& ind
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
|
||||
time_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
rstime_t InternalFileHierarchyStorage::recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index,bool& unfinished_files_present)
|
||||
{
|
||||
DirEntry& d(*static_cast<DirEntry*>(mNodes[dir_index])) ;
|
||||
|
||||
time_t largest_modf_time = d.dir_modtime ;
|
||||
rstime_t largest_modf_time = d.dir_modtime ;
|
||||
unfinished_files_present = false ;
|
||||
|
||||
for(uint32_t i=0;i<d.subfiles.size();++i)
|
||||
@ -732,7 +732,7 @@ public:
|
||||
inline virtual const std::string& file_name() const { return mFe.file_name ; }
|
||||
inline virtual uint64_t file_size() const { return mFe.file_size ; }
|
||||
inline virtual const RsFileHash& file_hash() const { return mFe.file_hash ; }
|
||||
inline virtual time_t file_modtime() const { return mFe.file_modtime ; }
|
||||
inline virtual rstime_t file_modtime() const { return mFe.file_modtime ; }
|
||||
inline virtual std::string file_parent_path()const { return RsDirUtil::makePath(mDe.dir_parent_path, mDe.dir_name) ; }
|
||||
inline virtual uint32_t file_popularity() const { NOT_IMPLEMENTED() ; return 0; }
|
||||
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
{
|
||||
public:
|
||||
FileEntry() : file_size(0), file_modtime(0) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,time_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime) : file_name(name),file_size(size),file_modtime(modtime) {}
|
||||
FileEntry(const std::string& name,uint64_t size,rstime_t modtime,const RsFileHash& hash) : file_name(name),file_size(size),file_modtime(modtime),file_hash(hash) {}
|
||||
|
||||
virtual uint32_t type() const { return FileStorageNode::TYPE_FILE ; }
|
||||
virtual ~FileEntry() {}
|
||||
@ -56,7 +56,7 @@ public:
|
||||
// local stuff
|
||||
std::string file_name ;
|
||||
uint64_t file_size ;
|
||||
time_t file_modtime;
|
||||
rstime_t file_modtime;
|
||||
RsFileHash file_hash ;
|
||||
};
|
||||
|
||||
@ -76,9 +76,9 @@ public:
|
||||
std::vector<DirectoryStorage::EntryIndex> subdirs ;
|
||||
std::vector<DirectoryStorage::EntryIndex> subfiles ;
|
||||
|
||||
time_t dir_modtime;
|
||||
time_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
time_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
rstime_t dir_modtime;
|
||||
rstime_t dir_most_recent_time;// recursive most recent modification time, including files and subdirs in the entire hierarchy below.
|
||||
rstime_t dir_update_time; // last time the information was updated for that directory. Includes subdirs indexes and subfile info.
|
||||
};
|
||||
|
||||
// class stuff
|
||||
@ -95,18 +95,18 @@ public:
|
||||
bool checkIndex(DirectoryStorage::EntryIndex indx,uint8_t type) const;
|
||||
bool updateSubFilesList(const DirectoryStorage::EntryIndex& indx,const std::map<std::string,DirectoryStorage::FileTS>& subfiles,std::map<std::string,DirectoryStorage::FileTS>& new_files);
|
||||
bool updateHash(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const time_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, time_t most_recent_time, time_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
bool updateFile(const DirectoryStorage::EntryIndex& file_index,const RsFileHash& hash, const std::string& fname,uint64_t size, const rstime_t modf_time);
|
||||
bool updateDirEntry(const DirectoryStorage::EntryIndex& indx, const std::string& dir_name, rstime_t most_recent_time, rstime_t dir_modtime, const std::vector<RsFileHash> &subdirs_hash, const std::vector<FileEntry> &subfiles_array);
|
||||
|
||||
// TS get/set functions. Take one of the class members as argument.
|
||||
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,time_t& TS,time_t DirEntry::* ) ;
|
||||
bool getTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) const;
|
||||
bool setTS(const DirectoryStorage::EntryIndex& index,rstime_t& TS,rstime_t DirEntry::* ) ;
|
||||
|
||||
// Do a complete recursive sweep over sub-directories and files, and update the lst modf TS. This could be also performed by a cleanup method.
|
||||
// Also keeps the high level statistics up to date.
|
||||
|
||||
time_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
rstime_t recursUpdateLastModfTime(const DirectoryStorage::EntryIndex& dir_index, bool &unfinished_files_present);
|
||||
|
||||
// hash stuff
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
#include <set>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "serialiser/rstlvbinary.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/rsdir.h"
|
||||
@ -71,7 +71,7 @@ DirectoryStorage::DirIterator ::operator bool() const { return **this != Directo
|
||||
RsFileHash DirectoryStorage::FileIterator::hash() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_hash):RsFileHash(); }
|
||||
uint64_t DirectoryStorage::FileIterator::size() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_size):0; }
|
||||
std::string DirectoryStorage::FileIterator::name() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_name):std::string(); }
|
||||
time_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
rstime_t DirectoryStorage::FileIterator::modtime() const { const InternalFileHierarchyStorage::FileEntry *f = mStorage->getFileEntry(**this) ; return f?(f->file_modtime):0; }
|
||||
|
||||
std::string DirectoryStorage::DirIterator::name() const { const InternalFileHierarchyStorage::DirEntry *d = mStorage->getDirEntry(**this) ; return d?(d->dir_name):std::string(); }
|
||||
|
||||
@ -119,13 +119,13 @@ uint32_t DirectoryStorage::getEntryType(const EntryIndex& indx)
|
||||
}
|
||||
}
|
||||
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,time_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,time_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
bool DirectoryStorage::getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::getDirectoryRecursModTime(EntryIndex index,rstime_t& rec_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::getDirectoryLocalModTime (EntryIndex index,rstime_t& loc_md_TS) const { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->getTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
|
||||
bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,time_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,time_t rec_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::setDirectoryLocalModTime (EntryIndex index,time_t loc_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
bool DirectoryStorage::setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,update_TS,&InternalFileHierarchyStorage::DirEntry::dir_update_time ); }
|
||||
bool DirectoryStorage::setDirectoryRecursModTime(EntryIndex index,rstime_t rec_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,rec_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_most_recent_time); }
|
||||
bool DirectoryStorage::setDirectoryLocalModTime (EntryIndex index,rstime_t loc_md_TS) { RS_STACK_MUTEX(mDirStorageMtx) ; return mFileHierarchy->setTS(index,loc_md_TS,&InternalFileHierarchyStorage::DirEntry::dir_modtime ); }
|
||||
|
||||
bool DirectoryStorage::updateSubDirectoryList(const EntryIndex& indx, const std::set<std::string> &subdirs, const RsFileHash& hash_salt)
|
||||
{
|
||||
@ -281,7 +281,7 @@ bool DirectoryStorage::getIndexFromDirHash(const RsFileHash& hash,EntryIndex& in
|
||||
|
||||
void DirectoryStorage::checkSave()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mChanged && mLastSavedTime + MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE < now)
|
||||
{
|
||||
@ -489,7 +489,7 @@ void LocalDirectoryStorage::updateTimeStamps()
|
||||
|
||||
bool unfinished_files_below ;
|
||||
|
||||
time_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
rstime_t last_modf_time = mFileHierarchy->recursUpdateLastModfTime(EntryIndex(0),unfinished_files_below) ;
|
||||
mTSChanged = false ;
|
||||
|
||||
#ifdef DEBUG_LOCAL_DIRECTORY_STORAGE
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "retroshare/rsids.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#define NOT_IMPLEMENTED() { std::cerr << __PRETTY_FUNCTION__ << ": not yet implemented." << std::endl; }
|
||||
|
||||
@ -52,13 +53,13 @@ class DirectoryStorage
|
||||
|
||||
// gets/sets the various time stamps:
|
||||
//
|
||||
bool getDirectoryRecursModTime(EntryIndex index,time_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,time_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,time_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
bool getDirectoryRecursModTime(EntryIndex index,rstime_t& recurs_max_modf_TS) const ; // last modification time, computed recursively over all subfiles and directories
|
||||
bool getDirectoryLocalModTime (EntryIndex index,rstime_t& motime_TS) const ; // last modification time for that index only
|
||||
bool getDirectoryUpdateTime (EntryIndex index,rstime_t& update_TS) const ; // last time the entry was updated. This is only used on the RemoteDirectoryStorage side.
|
||||
|
||||
bool setDirectoryRecursModTime(EntryIndex index,time_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,time_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,time_t update_TS) ;
|
||||
bool setDirectoryRecursModTime(EntryIndex index,rstime_t recurs_max_modf_TS) ;
|
||||
bool setDirectoryLocalModTime (EntryIndex index,rstime_t modtime_TS) ;
|
||||
bool setDirectoryUpdateTime (EntryIndex index,rstime_t update_TS) ;
|
||||
|
||||
uint32_t getEntryType(const EntryIndex& indx) ; // WARNING: returns DIR_TYPE_*, not the internal directory storage stuff.
|
||||
virtual bool extractData(const EntryIndex& indx,DirDetails& d);
|
||||
@ -81,8 +82,8 @@ class DirectoryStorage
|
||||
// info about the directory that is pointed by the iterator
|
||||
|
||||
std::string name() const ;
|
||||
time_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
time_t last_update_time() const ; // last time this directory was updated
|
||||
rstime_t last_modif_time() const ; // last time a file in this directory or in the directories below has been modified.
|
||||
rstime_t last_update_time() const ; // last time this directory was updated
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
uint32_t mDirTabIndex ; // index in the vector of subdirs.
|
||||
@ -106,7 +107,7 @@ class DirectoryStorage
|
||||
std::string name() const ;
|
||||
uint64_t size() const ;
|
||||
RsFileHash hash() const ;
|
||||
time_t modtime() const ;
|
||||
rstime_t modtime() const ;
|
||||
|
||||
private:
|
||||
EntryIndex mParentIndex ; // index of the parent dir.
|
||||
@ -117,7 +118,7 @@ class DirectoryStorage
|
||||
struct FileTS
|
||||
{
|
||||
uint64_t size ;
|
||||
time_t modtime;
|
||||
rstime_t modtime;
|
||||
};
|
||||
|
||||
EntryIndex root() const ; // returns the index of the root directory entry. This is generally 0.
|
||||
@ -171,7 +172,7 @@ class DirectoryStorage
|
||||
|
||||
InternalFileHierarchyStorage *mFileHierarchy ;
|
||||
|
||||
time_t mLastSavedTime ;
|
||||
rstime_t mLastSavedTime ;
|
||||
bool mChanged ;
|
||||
std::string mFileName;
|
||||
};
|
||||
@ -198,7 +199,7 @@ public:
|
||||
* returns the last time a sweep has been done over the directory in order to check update TS.
|
||||
* \return
|
||||
*/
|
||||
time_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
rstime_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
|
||||
/*!
|
||||
* \brief searchHash
|
||||
@ -212,7 +213,7 @@ public:
|
||||
virtual int searchHash(const RsFileHash& hash, EntryIndex& results) const ;
|
||||
|
||||
private:
|
||||
time_t mLastSweepTime ;
|
||||
rstime_t mLastSweepTime ;
|
||||
};
|
||||
|
||||
class LocalDirectoryStorage: public DirectoryStorage
|
||||
|
@ -64,7 +64,7 @@ void LocalDirectoryUpdater::setEnabled(bool b)
|
||||
|
||||
void LocalDirectoryUpdater::data_tick()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if (mIsEnabled || mForceUpdate)
|
||||
{
|
||||
@ -190,14 +190,14 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
|
||||
librs::util::FolderIterator dirIt(cumulated_path,mFollowSymLinks,false); // disallow symbolic links and files from the future.
|
||||
|
||||
time_t dir_local_mod_time ;
|
||||
rstime_t dir_local_mod_time ;
|
||||
if(!mSharedDirectories->getDirectoryLocalModTime(indx,dir_local_mod_time))
|
||||
{
|
||||
std::cerr << "(EE) Cannot get local mod time for dir index " << indx << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(mNeedsFullRecheck || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
||||
// we only want to detect when the directory has changed on the disk
|
||||
|
@ -27,6 +27,7 @@
|
||||
//
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class LocalDirectoryUpdater: public HashStorageClient, public RsTickingThread
|
||||
{
|
||||
@ -77,8 +78,8 @@ private:
|
||||
|
||||
RsFileHash mHashSalt ;
|
||||
|
||||
time_t mLastSweepTime;
|
||||
time_t mLastTSUpdateTime;
|
||||
rstime_t mLastSweepTime;
|
||||
rstime_t mLastTSUpdateTime;
|
||||
|
||||
uint32_t mDelayBetweenDirectoryUpdates;
|
||||
bool mIsEnabled ;
|
||||
|
@ -232,7 +232,7 @@ void HashStorage::data_tick()
|
||||
job.client->hash_callback(job.client_param, job.full_path, hash, size);
|
||||
}
|
||||
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
bool HashStorage::requestHash(const std::string& full_path,uint64_t size,rstime_t mod_time,RsFileHash& known_hash,HashStorageClient *c,uint32_t client_param)
|
||||
{
|
||||
// check if the hash is up to date w.r.t. cache.
|
||||
|
||||
@ -243,7 +243,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
|
||||
std::string real_path = RsDirUtil::removeSymLinks(full_path) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
std::map<std::string,HashStorageInfo>::iterator it = mFiles.find(real_path) ;
|
||||
|
||||
// On windows we compare the time up to +/- 3600 seconds. This avoids re-hashing files in case of daylight saving change.
|
||||
@ -318,8 +318,8 @@ void HashStorage::clean()
|
||||
{
|
||||
RS_STACK_MUTEX(mHashMtx) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
time_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
rstime_t now = time(NULL) ;
|
||||
rstime_t duration = mMaxStorageDurationDays * 24 * 3600 ; // seconds
|
||||
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << "Cleaning hash cache." << std::endl ;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <map>
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
/*!
|
||||
* \brief The HashStorageClient class
|
||||
@ -65,7 +66,7 @@ public:
|
||||
*
|
||||
* \return true if the supplied hash info is up to date.
|
||||
*/
|
||||
bool requestHash(const std::string& full_path, uint64_t size, time_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
bool requestHash(const std::string& full_path, uint64_t size, rstime_t mod_time, RsFileHash& known_hash, HashStorageClient *c, uint32_t client_param) ;
|
||||
|
||||
struct HashStorageInfo
|
||||
{
|
||||
@ -120,7 +121,7 @@ private:
|
||||
uint64_t size ;
|
||||
HashStorageClient *client;
|
||||
uint32_t client_param ;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
};
|
||||
|
||||
// current work
|
||||
@ -136,7 +137,7 @@ private:
|
||||
uint64_t mTotalSizeToHash ;
|
||||
uint64_t mTotalHashedSize ;
|
||||
uint64_t mTotalFilesToHash ;
|
||||
time_t mLastSaveTime ;
|
||||
rstime_t mLastSaveTime ;
|
||||
|
||||
// The following is used to estimate hashing speed.
|
||||
|
||||
|
@ -171,7 +171,7 @@ int p3FileDatabase::tick()
|
||||
tickRecv() ;
|
||||
tickSend() ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// cleanup
|
||||
// - remove/delete shared file lists for people who are not friend anymore
|
||||
@ -183,7 +183,7 @@ int p3FileDatabase::tick()
|
||||
mLastCleanupTime = now ;
|
||||
}
|
||||
|
||||
static time_t last_print_time = 0;
|
||||
static rstime_t last_print_time = 0;
|
||||
|
||||
if(last_print_time + 20 < now)
|
||||
{
|
||||
@ -604,15 +604,15 @@ void p3FileDatabase::cleanup()
|
||||
for(std::list<RsPeerId>::const_iterator it(friend_lst.begin());it!=friend_lst.end();++it)
|
||||
friend_set.insert(*it) ;
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(uint32_t i=0;i<mRemoteDirectories.size();++i)
|
||||
if(mRemoteDirectories[i] != NULL)
|
||||
{
|
||||
time_t recurs_mod_time ;
|
||||
rstime_t recurs_mod_time ;
|
||||
mRemoteDirectories[i]->getDirectoryRecursModTime(0,recurs_mod_time) ;
|
||||
|
||||
time_t last_contact = 0 ;
|
||||
rstime_t last_contact = 0 ;
|
||||
RsPeerDetails pd ;
|
||||
if(rsPeers->getPeerDetails(mRemoteDirectories[i]->peerId(),pd))
|
||||
last_contact = pd.lastConnect ;
|
||||
@ -976,7 +976,7 @@ void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIn
|
||||
{
|
||||
// update the cache of extra files if last requested too long ago
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mLastExtraFilesCacheUpdate + DELAY_BETWEEN_EXTRA_FILES_CACHE_UPDATES <= now)
|
||||
{
|
||||
@ -1627,7 +1627,7 @@ void p3FileDatabase::handleDirSyncRequest(RsFileListsSyncRequestItem *item)
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t local_recurs_max_time ;
|
||||
rstime_t local_recurs_max_time ;
|
||||
mLocalSharedDirs->getDirectoryRecursModTime(entry_index,local_recurs_max_time) ;
|
||||
|
||||
if(item->last_known_recurs_modf_TS != local_recurs_max_time) // normally, should be "<", but since we provided the TS it should be equal, so != is more robust.
|
||||
@ -1792,7 +1792,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
sitem = item ;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// check the hash. If anything goes wrong (in the chunking for instance) the hash will not match
|
||||
|
||||
@ -1899,7 +1899,7 @@ void p3FileDatabase::handleDirSyncResponse(RsFileListsSyncResponseItem*& sitem)
|
||||
|
||||
void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *rds,DirectoryStorage::EntryIndex e,int depth)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
//std::string indent(2*depth,' ') ;
|
||||
|
||||
@ -1912,7 +1912,7 @@ void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *r
|
||||
P3FILELISTS_DEBUG() << "currently at entry index " << e << std::endl;
|
||||
#endif
|
||||
|
||||
time_t local_update_TS;
|
||||
rstime_t local_update_TS;
|
||||
|
||||
if(!rds->getDirectoryUpdateTime(e,local_update_TS))
|
||||
{
|
||||
@ -1959,9 +1959,9 @@ p3FileDatabase::DirSyncRequestId p3FileDatabase::makeDirSyncReqId(const RsPeerId
|
||||
bool p3FileDatabase::locked_generateAndSendSyncRequest(RemoteDirectoryStorage *rds,const DirectoryStorage::EntryIndex& e)
|
||||
{
|
||||
RsFileHash entry_hash ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
time_t max_known_recurs_modf_time ;
|
||||
rstime_t max_known_recurs_modf_time ;
|
||||
|
||||
if(!rds->getDirectoryRecursModTime(e,max_known_recurs_modf_time))
|
||||
{
|
||||
@ -2118,7 +2118,7 @@ void p3FileDatabase::checkSendBannedFilesInfo()
|
||||
P3FILELISTS_DEBUG() << " Checking banned files information: " << std::endl;
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::list<RsPeerId> online_friends ;
|
||||
rsPeers->getOnlineList(online_friends);
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include "ft/ftextralist.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "services/p3service.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "file_sharing/hash_cache.h"
|
||||
#include "file_sharing/directory_storage.h"
|
||||
|
||||
@ -71,7 +71,7 @@ struct PeerBannedFilesEntry
|
||||
{
|
||||
std::set<RsFileHash> mBannedHashOfHash;
|
||||
uint32_t mSessionId ; // used for when a friend sends multiple packets in separate items.
|
||||
time_t mLastSent;
|
||||
rstime_t mLastSent;
|
||||
};
|
||||
|
||||
class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, public RsSharedFileService
|
||||
@ -246,11 +246,11 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
struct DirSyncRequestData
|
||||
{
|
||||
RsPeerId peer_id ;
|
||||
time_t request_TS ;
|
||||
rstime_t request_TS ;
|
||||
uint32_t flags ;
|
||||
};
|
||||
|
||||
time_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
rstime_t mLastRemoteDirSweepTS ; // TS for friend list update
|
||||
std::map<DirSyncRequestId,DirSyncRequestData> mPendingSyncRequests ; // pending requests, waiting for an answer
|
||||
std::map<DirSyncRequestId,RsFileListsSyncResponseItem *> mPartialResponseItems;
|
||||
|
||||
@ -265,8 +265,8 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
mutable RsMutex mFLSMtx ;
|
||||
uint32_t mUpdateFlags ;
|
||||
std::string mFileSharingDir ;
|
||||
time_t mLastCleanupTime;
|
||||
time_t mLastDataRecvTS ;
|
||||
rstime_t mLastCleanupTime;
|
||||
rstime_t mLastDataRecvTS ;
|
||||
|
||||
// File filtering. Not explicitly related to shared files, but has its place here
|
||||
//
|
||||
@ -275,10 +275,10 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
||||
std::map<RsPeerId,PeerBannedFilesEntry> mPeerBannedFiles ; // records of which files other peers ban, stored as H(H(f))
|
||||
std::set<RsFileHash> mBannedFileList ; // list of banned hashes. This include original hashs and H(H(f)) when coming from friends.
|
||||
mutable std::vector<FileInfo> mExtraFilesCache; // cache for extra files, to avoid requesting them too often.
|
||||
mutable time_t mLastExtraFilesCacheUpdate ;
|
||||
mutable rstime_t mLastExtraFilesCacheUpdate ;
|
||||
bool mTrustFriendNodesForBannedFiles ;
|
||||
bool mBannedFileListNeedsUpdate;
|
||||
time_t mLastPrimaryBanListChangeTimeStamp;
|
||||
rstime_t mLastPrimaryBanListChangeTimeStamp;
|
||||
|
||||
void locked_sendBanInfo(const RsPeerId& pid);
|
||||
void handleBannedFilesInfo(RsFileListsBannedHashesItem *item);
|
||||
|
@ -54,7 +54,7 @@ template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJ
|
||||
{
|
||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,entry.filename ,"entry.file_name") ;
|
||||
RsTypeSerializer::serial_process<uint64_t>(j,ctx, entry.size ,"entry.size") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx, entry.ban_time_stamp,"entry.ban_time_stamp") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx, entry.ban_time_stamp,"entry.ban_time_stamp") ;
|
||||
}
|
||||
RsItem *RsFileListsSerialiser::create_item(uint16_t service,uint8_t type) const
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "ftchunkmap.h"
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
static const uint32_t SOURCE_CHUNK_MAP_UPDATE_PERIOD = 60 ; //! TTL for chunkmap info
|
||||
static const uint32_t INACTIVE_CHUNK_TIME_LAPSE = 3600 ; //! TTL for an inactive chunk
|
||||
@ -264,7 +264,7 @@ bool ChunkMap::reAskPendingChunk( const RsPeerId& peer_id,
|
||||
if(_map[i] == FileChunksInfo::CHUNK_OUTSTANDING)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<uint32_t,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();++it)
|
||||
for(std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo >::iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
@ -400,7 +400,7 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
void ChunkMap::removeInactiveChunks(std::vector<ftChunk::OffsetInFile>& to_remove)
|
||||
{
|
||||
to_remove.clear() ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<ChunkNumber,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();)
|
||||
if(now - it->second._last_data_received > (int)INACTIVE_CHUNK_TIME_LAPSE)
|
||||
@ -573,7 +573,7 @@ uint32_t ChunkMap::getAvailableChunk(const RsPeerId& peer_id,bool& map_is_too_ol
|
||||
// useful to get a new map that will also be full, but because we need to be careful not to mislead information,
|
||||
// we still keep asking.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if((!peer_chunks->is_full) && ((int)now - (int)peer_chunks->TS > (int)SOURCE_CHUNK_MAP_UPDATE_PERIOD))
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ class ftChunk
|
||||
uint64_t offset; // current offset of the slice
|
||||
uint64_t size; // size remaining to download
|
||||
OffsetInFile id ; // id of the chunk. Equal to the starting offset of the chunk
|
||||
time_t ts; // time of last data received
|
||||
rstime_t ts; // time of last data received
|
||||
int *ref_cnt; // shared counter of number of sub-blocks. Used when a slice gets split.
|
||||
RsPeerId peer_id ;
|
||||
};
|
||||
@ -98,20 +98,20 @@ struct ChunkDownloadInfo
|
||||
struct SliceRequestInfo
|
||||
{
|
||||
uint32_t size ; // size of the slice
|
||||
time_t request_time ; // last request time
|
||||
rstime_t request_time ; // last request time
|
||||
std::set<RsPeerId> peers ; // peers the slice was requested to. Normally only one, except at the end of the file.
|
||||
};
|
||||
|
||||
std::map<ftChunk::OffsetInFile,SliceRequestInfo> _slices ;
|
||||
uint32_t _remains ;
|
||||
time_t _last_data_received ;
|
||||
rstime_t _last_data_received ;
|
||||
};
|
||||
|
||||
class SourceChunksInfo
|
||||
{
|
||||
public:
|
||||
CompressedChunkMap cmap ; //! map of what the peer has/doens't have
|
||||
time_t TS ; //! last update time for this info
|
||||
rstime_t TS ; //! last update time for this info
|
||||
bool is_full ; //! is the map full ? In such a case, re-asking for it is unnecessary.
|
||||
|
||||
// Returns true if the offset is starting in a mapped chunk.
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "rsitems/rsconfigitems.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define CONTROL_DEBUG 1
|
||||
@ -226,7 +226,7 @@ void ftController::data_tick()
|
||||
doPending = (mFtActive) && (!mFtPendingDone);
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
if(now > last_save_time + SAVE_TRANSFERS_DELAY)
|
||||
{
|
||||
IndicateConfigChanged() ;
|
||||
@ -421,11 +421,11 @@ void ftController::checkDownloadQueue()
|
||||
|
||||
// Check for inactive transfers, and queued transfers with online sources.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsFileHash,ftFileControl*>::const_iterator it(mDownloads.begin());it!=mDownloads.end() ;++it)
|
||||
if( it->second->mState != ftFileControl::QUEUED && (it->second->mState == ftFileControl::PAUSED
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (time_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
|| now > it->second->mTransfer->lastActvTimeStamp() + (rstime_t)MAX_TIME_INACTIVE_REQUEUED))
|
||||
{
|
||||
inactive_transfers.push_back(it->second) ;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class ftFileControl
|
||||
RsFileHash mHash;
|
||||
uint64_t mSize;
|
||||
TransferRequestFlags mFlags;
|
||||
time_t mCreateTime;
|
||||
rstime_t mCreateTime;
|
||||
uint32_t mQueuePriority ;
|
||||
uint32_t mQueuePosition ;
|
||||
};
|
||||
@ -226,8 +226,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
||||
bool setPeerState(ftTransferModule *tm, const RsPeerId& id,
|
||||
uint32_t maxrate, bool online);
|
||||
|
||||
time_t last_save_time ;
|
||||
time_t last_clean_time ;
|
||||
rstime_t last_save_time ;
|
||||
rstime_t last_clean_time ;
|
||||
/* pointers to other components */
|
||||
|
||||
ftSearch *mSearch;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsmemory.h"
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/* For Thread Behaviour */
|
||||
const uint32_t DMULTIPLEX_MIN = 10; /* 10 msec sleep */
|
||||
@ -452,7 +452,7 @@ bool ftDataMultiplex::recvSingleChunkCRC(const RsPeerId& peerId, const RsFileHas
|
||||
// remove this chunk from the request list as well.
|
||||
|
||||
Sha1CacheEntry& sha1cache(_cached_sha1maps[hash]) ;
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(sha1cache._to_ask.find(chunk_number)) ;
|
||||
|
||||
if(it2 != sha1cache._to_ask.end())
|
||||
sha1cache._to_ask.erase(it2) ;
|
||||
@ -943,7 +943,7 @@ bool ftDataMultiplex::sendSingleChunkCRCRequests(const RsFileHash& hash, const s
|
||||
|
||||
for(uint32_t i=0;i<to_ask.size();++i)
|
||||
{
|
||||
std::pair<time_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
std::pair<rstime_t,ChunkCheckSumSourceList>& list(ce._to_ask[to_ask[i]]) ;
|
||||
list.first = 0 ; // set last request time to 0
|
||||
}
|
||||
return true ;
|
||||
@ -953,7 +953,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
{
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uint32_t n=0 ;
|
||||
|
||||
// Go through the list of currently handled hashes. For each of them,
|
||||
@ -966,7 +966,7 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
for(std::map<RsFileHash,Sha1CacheEntry>::iterator it(_cached_sha1maps.begin());it!=_cached_sha1maps.end();++it)
|
||||
for(std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
for(std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> >::iterator it2(it->second._to_ask.begin());it2!=it->second._to_ask.end();++it2)
|
||||
if(it2->second.first + MAX_CHECKING_CHUNK_WAIT_DELAY < now) // is the last request old enough?
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
@ -986,14 +986,14 @@ void ftDataMultiplex::handlePendingCrcRequests()
|
||||
//
|
||||
|
||||
RsPeerId best_source ;
|
||||
time_t oldest_timestamp = now ;
|
||||
rstime_t oldest_timestamp = now ;
|
||||
|
||||
for(uint32_t i=0;i<sources.size();++i)
|
||||
{
|
||||
#ifdef MPLEX_DEBUG
|
||||
std::cerr << "ftDataMultiplex::handlePendingCrcRequests(): Examining source " << sources[i] << std::endl;
|
||||
#endif
|
||||
std::map<RsPeerId,time_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
std::map<RsPeerId,rstime_t>::const_iterator it3(it2->second.second.find(sources[i])) ;
|
||||
|
||||
if(it3 == it2->second.second.end()) // source not found. So this one is surely the oldest one to have been requested.
|
||||
{
|
||||
@ -1044,7 +1044,7 @@ void ftDataMultiplex::deleteUnusedServers()
|
||||
RsStackMutex stack(dataMtx); /******* LOCK MUTEX ******/
|
||||
|
||||
//scan the uploads list in ftdatamultiplex and delete the items which time out
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
for(std::map<RsFileHash, ftFileProvider *>::iterator sit(mServers.begin());sit != mServers.end();)
|
||||
if(sit->second->purgeOldPeers(now,10))
|
||||
|
@ -74,15 +74,15 @@ class ftRequest
|
||||
void *mData;
|
||||
};
|
||||
|
||||
typedef std::map<RsPeerId,time_t> ChunkCheckSumSourceList ;
|
||||
typedef std::map<RsPeerId,rstime_t> ChunkCheckSumSourceList ;
|
||||
|
||||
class Sha1CacheEntry
|
||||
{
|
||||
public:
|
||||
Sha1Map _map ; // Map of available sha1 sums for every chunk.
|
||||
time_t last_activity ; // This is used for removing unused entries.
|
||||
rstime_t last_activity ; // This is used for removing unused entries.
|
||||
std::vector<uint32_t> _received ; // received chunk ids. To bedispatched.
|
||||
std::map<uint32_t,std::pair<time_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
std::map<uint32_t,std::pair<rstime_t,ChunkCheckSumSourceList> > _to_ask ; // Chunks to ask to sources.
|
||||
};
|
||||
|
||||
class ftDataMultiplex: public ftDataRecv, public RsQueueThread
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "util/rstime.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* for (u)sleep() */
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/******
|
||||
* #define DEBUG_ELIST 1
|
||||
@ -49,7 +49,7 @@ ftExtraList::ftExtraList()
|
||||
void ftExtraList::data_tick()
|
||||
{
|
||||
bool todo = false;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
{
|
||||
RsStackMutex stack(extMutex);
|
||||
@ -229,12 +229,12 @@ bool ftExtraList::cleanupOldFiles()
|
||||
|
||||
RS_STACK_MUTEX(extMutex);
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
std::list<RsFileHash> toRemove;
|
||||
|
||||
for( std::map<RsFileHash, FileDetails>::iterator it = mFiles.begin(); it != mFiles.end(); ++it) /* check timestamps */
|
||||
if ((time_t)it->second.info.age < now)
|
||||
if ((rstime_t)it->second.info.age < now)
|
||||
toRemove.push_back(it->first);
|
||||
|
||||
if (toRemove.size() > 0)
|
||||
@ -450,7 +450,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
@ -475,7 +475,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
|
||||
fclose(fd);
|
||||
fd = NULL ;
|
||||
|
||||
if (ts > (time_t)fi->file.age)
|
||||
if (ts > (rstime_t)fi->file.age)
|
||||
{
|
||||
/* to old */
|
||||
cleanupEntry(fi->file.path, TransferRequestFlags(fi->flags));
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "util/rsthreads.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
class FileDetails
|
||||
{
|
||||
@ -177,7 +178,7 @@ private:
|
||||
std::map<RsFileHash, FileDetails> mFiles;
|
||||
std::map<RsFileHash, RsFileHash> mHashOfHash; /* sha1(hash) map so as to answer requests to encrypted transfers */
|
||||
|
||||
time_t cleanup ;
|
||||
rstime_t cleanup ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "ftfilecreator.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <sys/stat.h>
|
||||
#include <util/rsdiscspace.h>
|
||||
#include <util/rsdir.h>
|
||||
@ -63,7 +63,7 @@ ftFileCreator::ftFileCreator(const std::string& path, uint64_t size, const RsFil
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
_creation_time = now ;
|
||||
|
||||
struct stat64 buf;
|
||||
@ -143,12 +143,12 @@ bool ftFileCreator::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32_
|
||||
return false ;
|
||||
}
|
||||
|
||||
time_t ftFileCreator::creationTimeStamp()
|
||||
rstime_t ftFileCreator::creationTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _creation_time ;
|
||||
}
|
||||
time_t ftFileCreator::lastRecvTimeStamp()
|
||||
rstime_t ftFileCreator::lastRecvTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
return _last_recv_time_t ;
|
||||
@ -520,7 +520,7 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
|
||||
locked_printChunkMap();
|
||||
#endif
|
||||
source_chunk_map_needed = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// 0 - is there a faulting chunk that would need to be asked again ?
|
||||
|
||||
|
@ -103,8 +103,8 @@ class ftFileCreator: public ftFileProvider
|
||||
void getSourcesList(uint32_t chunk_number,std::vector<RsPeerId>& sources) ;
|
||||
|
||||
// Returns resets the time stamp of the last data receive.
|
||||
time_t lastRecvTimeStamp() ;
|
||||
time_t creationTimeStamp() ;
|
||||
rstime_t lastRecvTimeStamp() ;
|
||||
rstime_t creationTimeStamp() ;
|
||||
|
||||
// actually store data in the file, and update chunks info
|
||||
//
|
||||
@ -144,8 +144,8 @@ class ftFileCreator: public ftFileProvider
|
||||
|
||||
ChunkMap chunkMap ;
|
||||
|
||||
time_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
time_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
rstime_t _last_recv_time_t ; /// last time stamp when data was received. Used for queue control.
|
||||
rstime_t _creation_time ; /// time at which the file creator was created. Used to spot long-inactive transfers.
|
||||
};
|
||||
|
||||
#endif // FT_FILE_CREATOR_HEADER
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "util/rsdir.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/********
|
||||
* #define DEBUG_FT_FILE_PROVIDER 1
|
||||
@ -41,7 +41,7 @@
|
||||
#include <iomanip>
|
||||
#endif
|
||||
|
||||
static const time_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
static const rstime_t UPLOAD_CHUNK_MAPS_TIME = 20 ; // time to ask for a new chunkmap from uploaders in seconds.
|
||||
|
||||
ftFileProvider::ftFileProvider(const std::string& path, uint64_t size, const RsFileHash& hash)
|
||||
: mSize(size), hash(hash), file_name(path), fd(NULL), ftcMutex("ftFileProvider")
|
||||
@ -122,7 +122,7 @@ bool ftFileProvider::FileDetails(FileInfo &info)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ftFileProvider::purgeOldPeers(time_t now,uint32_t max_duration)
|
||||
bool ftFileProvider::purgeOldPeers(rstime_t now,uint32_t max_duration)
|
||||
{
|
||||
RsStackMutex stack(ftcMutex); /********** STACK LOCKED MTX ******/
|
||||
|
||||
@ -232,7 +232,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
|
||||
// This creates the peer info, and updates it.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uploading_peers[peer_id].updateStatus(offset,data_size,now) ;
|
||||
|
||||
#ifdef DEBUG_TRANSFERS
|
||||
@ -254,7 +254,7 @@ bool ftFileProvider::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,time_t now)
|
||||
void ftFileProvider::PeerUploadInfo::updateStatus(uint64_t offset,uint32_t data_size,rstime_t now)
|
||||
{
|
||||
lastTS = now ;
|
||||
long int diff = (long int)now - (long int)lastTS_t ; // in bytes/s. Average over multiple samples
|
||||
@ -293,7 +293,7 @@ void ftFileProvider::getClientMap(const RsPeerId& peer_id,CompressedChunkMap& cm
|
||||
|
||||
PeerUploadInfo& pui(uploading_peers[peer_id]) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now - pui.client_chunk_map_stamp > UPLOAD_CHUNK_MAPS_TIME)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ class ftFileProvider
|
||||
|
||||
// Removes inactive peers from the client list. Returns true if all peers have been removed.
|
||||
//
|
||||
bool purgeOldPeers(time_t now,uint32_t max_duration) ;
|
||||
bool purgeOldPeers(rstime_t now,uint32_t max_duration) ;
|
||||
|
||||
const RsFileHash& fileHash() const { return hash ; }
|
||||
const std::string& fileName() const { return file_name ; }
|
||||
@ -88,12 +88,12 @@ class ftFileProvider
|
||||
PeerUploadInfo()
|
||||
: req_loc(0),req_size(1), lastTS_t(0), lastTS(0),transfer_rate(0), total_size(0), client_chunk_map_stamp(0) {}
|
||||
|
||||
void updateStatus(uint64_t offset,uint32_t data_size,time_t now) ;
|
||||
void updateStatus(uint64_t offset,uint32_t data_size,rstime_t now) ;
|
||||
|
||||
uint64_t req_loc;
|
||||
uint32_t req_size;
|
||||
time_t lastTS_t; // used for estimating transfer rate.
|
||||
time_t lastTS; // last update time (for purging)
|
||||
rstime_t lastTS_t; // used for estimating transfer rate.
|
||||
rstime_t lastTS; // last update time (for purging)
|
||||
|
||||
// these two are used for speed estimation
|
||||
float transfer_rate ;
|
||||
@ -101,7 +101,7 @@ class ftFileProvider
|
||||
|
||||
// Info about what the downloading peer already has
|
||||
CompressedChunkMap client_chunk_map ;
|
||||
time_t client_chunk_map_stamp ;
|
||||
rstime_t client_chunk_map_stamp ;
|
||||
};
|
||||
|
||||
// Contains statistics (speed, peer name, etc.) of all uploading peers for that file.
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "util/rsprint.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
/***
|
||||
* #define SERVER_DEBUG 1
|
||||
@ -62,8 +62,8 @@
|
||||
#define FTSERVER_DEBUG() std::cerr << time(NULL) << " : FILE_SERVER : " << __FUNCTION__ << " : "
|
||||
#define FTSERVER_ERROR() std::cerr << "(EE) FILE_SERVER ERROR : "
|
||||
|
||||
static const time_t FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD = 5 ; // low priority tasks handling every 5 seconds
|
||||
static const time_t FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD = 10 ; // keep usage records for 10 secs at most.
|
||||
static const rstime_t FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD = 5 ; // low priority tasks handling every 5 seconds
|
||||
static const rstime_t FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD = 10 ; // keep usage records for 10 secs at most.
|
||||
|
||||
/* Setup */
|
||||
ftServer::ftServer(p3PeerMgr *pm, p3ServiceControl *sc)
|
||||
@ -1625,8 +1625,8 @@ int ftServer::tick()
|
||||
if(handleIncoming())
|
||||
moreToTick = true;
|
||||
|
||||
static time_t last_law_priority_tasks_handling_time = 0 ;
|
||||
time_t now = time(NULL) ;
|
||||
static rstime_t last_law_priority_tasks_handling_time = 0 ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(last_law_priority_tasks_handling_time + FILE_TRANSFER_LOW_PRIORITY_TASKS_PERIOD < now)
|
||||
{
|
||||
@ -1666,10 +1666,10 @@ bool ftServer::checkUploadLimit(const RsPeerId& pid,const RsFileHash& hash)
|
||||
|
||||
// Find the latest records for this pid.
|
||||
|
||||
std::map<RsFileHash,time_t>& tmap(mUploadLimitMap[pid]) ;
|
||||
std::map<RsFileHash,time_t>::iterator it ;
|
||||
std::map<RsFileHash,rstime_t>& tmap(mUploadLimitMap[pid]) ;
|
||||
std::map<RsFileHash,rstime_t>::iterator it ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// If the limit has been decresed, we arbitrarily drop some ongoing slots.
|
||||
|
||||
@ -1694,7 +1694,7 @@ bool ftServer::checkUploadLimit(const RsPeerId& pid,const RsFileHash& hash)
|
||||
for(it = tmap.begin();it!=tmap.end() && cleaned<2;)
|
||||
if(it->second + FILE_TRANSFER_MAX_DELAY_BEFORE_DROP_USAGE_RECORD < now)
|
||||
{
|
||||
std::map<RsFileHash,time_t>::iterator tmp(it) ;
|
||||
std::map<RsFileHash,rstime_t>::iterator tmp(it) ;
|
||||
++tmp;
|
||||
tmap.erase(it) ;
|
||||
it = tmp;
|
||||
@ -1859,7 +1859,7 @@ bool ftServer::addConfiguration(p3ConfigMgr *cfgmgr)
|
||||
bool ftServer::turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const std::list<TurtleFileInfo>& results)>& multiCallback,
|
||||
std::time_t maxWait )
|
||||
rstime_t maxWait )
|
||||
{
|
||||
if(matchString.empty())
|
||||
{
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
virtual bool turtleSearchRequest(
|
||||
const std::string& matchString,
|
||||
const std::function<void (const std::list<TurtleFileInfo>& results)>& multiCallback,
|
||||
std::time_t maxWait = 300 );
|
||||
rstime_t maxWait = 300 );
|
||||
|
||||
virtual TurtleSearchRequestId turtleSearch(const std::string& string_to_match) ;
|
||||
virtual TurtleSearchRequestId turtleSearch(const RsRegularExpression::LinearizedExpression& expr) ;
|
||||
@ -326,7 +326,7 @@ private:
|
||||
|
||||
std::map<RsFileHash,RsFileHash> mEncryptedHashes ; // This map is such that sha1(it->second) = it->first
|
||||
std::map<RsPeerId,RsFileHash> mEncryptedPeerIds ; // This map holds the hash to be used with each peer id
|
||||
std::map<RsPeerId,std::map<RsFileHash,time_t> > mUploadLimitMap ;
|
||||
std::map<RsPeerId,std::map<RsFileHash,rstime_t> > mUploadLimitMap ;
|
||||
|
||||
/** Store search callbacks with timeout*/
|
||||
std::map<
|
||||
|
@ -23,7 +23,7 @@
|
||||
* #define FT_DEBUG 1
|
||||
*****/
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include "fttransfermodule.h"
|
||||
@ -285,7 +285,7 @@ void ftTransferModule::resetActvTimeStamp()
|
||||
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
|
||||
_last_activity_time_stamp = time(NULL);
|
||||
}
|
||||
time_t ftTransferModule::lastActvTimeStamp()
|
||||
rstime_t ftTransferModule::lastActvTimeStamp()
|
||||
{
|
||||
RsStackMutex stack(tfMtx); /******* STACK LOCKED ******/
|
||||
return _last_activity_time_stamp ;
|
||||
@ -693,7 +693,7 @@ void ftTransferModule::adjustSpeed()
|
||||
bool ftTransferModule::locked_tickPeerTransfer(peerInfo &info)
|
||||
{
|
||||
/* how long has it been? */
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
|
||||
int ageRecv = ts - info.recvTS;
|
||||
int ageReq = ts - info.lastTS;
|
||||
@ -865,7 +865,7 @@ bool ftTransferModule::locked_recvPeerData(peerInfo &info, uint64_t offset, uint
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
time_t ts = time(NULL);
|
||||
rstime_t ts = time(NULL);
|
||||
info.recvTS = ts;
|
||||
info.nResets = 0;
|
||||
info.state = PQIPEER_DOWNLOADING;
|
||||
|
@ -76,15 +76,15 @@ public:
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
|
||||
time_t lastTS; /* last Request */
|
||||
time_t recvTS; /* last Recv */
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
|
||||
/* rrt rate control */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
time_t rttStart; /* ts of request */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate */
|
||||
};
|
||||
@ -156,7 +156,7 @@ public:
|
||||
void setDownloadPriority(DwlSpeed p) { mPriority =p ; }
|
||||
|
||||
// read/reset the last time the transfer module was active (either wrote data, or was solicitaded by clients)
|
||||
time_t lastActvTimeStamp() ;
|
||||
rstime_t lastActvTimeStamp() ;
|
||||
void resetActvTimeStamp() ;
|
||||
|
||||
private:
|
||||
@ -185,7 +185,7 @@ private:
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
|
||||
time_t _last_activity_time_stamp ;
|
||||
rstime_t _last_activity_time_stamp ;
|
||||
|
||||
ftFileStatus mFileStatus; //used for pause/resume file transfer
|
||||
|
||||
|
@ -50,7 +50,7 @@ class GRouterCacheInfo
|
||||
{
|
||||
public:
|
||||
GRouterCacheInfoFlags flags ;
|
||||
time_t last_activity ;
|
||||
rstime_t last_activity ;
|
||||
};
|
||||
|
||||
class GRouterCache
|
||||
|
@ -144,10 +144,10 @@ void RsGRouterRoutingInfoItem::serial_process(RsGenericSerializer::SerializeJob
|
||||
RsTypeSerializer::serial_process (j,ctx,peerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,data_status,"data_status") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,tunnel_status,"tunnel_status") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,received_time_TS,"received_time_TS") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,last_sent_TS,"last_sent_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,received_time_TS,"received_time_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,last_sent_TS,"last_sent_TS") ;
|
||||
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,last_tunnel_request_TS,"last_tunnel_request_TS") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,last_tunnel_request_TS,"last_tunnel_request_TS") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,sending_attempts,"sending_attempts") ;
|
||||
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,client_id,"client_id") ;
|
||||
@ -215,7 +215,7 @@ void RsGRouterMatrixTrackItem::serial_process(RsGenericSerializer::SerializeJob
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,provider_id,"provider_id") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,message_id,"message_id") ;
|
||||
RsTypeSerializer::serial_process<time_t>(j,ctx,time_stamp,"time_stamp") ;
|
||||
RsTypeSerializer::serial_process<rstime_t>(j,ctx,time_stamp,"time_stamp") ;
|
||||
}
|
||||
|
||||
void RsGRouterMatrixCluesItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
@ -228,7 +228,7 @@ template<> void RsTypeSerializer::serial_process(RsGenericSerializer::SerializeJ
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,s.friend_id,name+":friend_id") ;
|
||||
RsTypeSerializer::serial_process<float> (j,ctx,s.weight,name+":weight") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,s.time_stamp,name+":time_stamp") ;
|
||||
RsTypeSerializer::serial_process<rstime_t> (j,ctx,s.time_stamp,name+":time_stamp") ;
|
||||
}
|
||||
|
||||
RsGRouterGenericDataItem *RsGRouterGenericDataItem::duplicate() const
|
||||
|
@ -224,7 +224,7 @@ class RsGRouterMatrixTrackItem: public RsGRouterItem
|
||||
//
|
||||
RsGxsMessageId message_id ;
|
||||
RsPeerId provider_id ;
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
class RsGRouterMatrixFriendListItem: public RsGRouterItem
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ GRouterMatrix::GRouterMatrix()
|
||||
|
||||
bool GRouterMatrix::addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& source_friend)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RoutingTrackEntry rte ;
|
||||
|
||||
@ -57,7 +57,7 @@ bool GRouterMatrix::cleanUp()
|
||||
#ifdef ROUTING_MATRIX_DEBUG
|
||||
std::cerr << "GRouterMatrix::cleanup()" << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<RsGxsMessageId,RoutingTrackEntry>::iterator it(_tracking_clues.begin());it!=_tracking_clues.end();)
|
||||
if(it->second.time_stamp + RS_GROUTER_MAX_KEEP_TRACKING_CLUES < now)
|
||||
@ -84,7 +84,7 @@ bool GRouterMatrix::addRoutingClue(const GRouterKeyId& key_id,const RsPeerId& so
|
||||
|
||||
// 2 - get the Key map, and add the routing clue.
|
||||
//
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RoutingMatrixHitEntry rc ;
|
||||
rc.weight = weight ;
|
||||
@ -179,7 +179,7 @@ void GRouterMatrix::debugDump() const
|
||||
std::cerr << " Proba needs up: " << _proba_need_updating << std::endl;
|
||||
std::cerr << " Known keys: " << _time_combined_hits.size() << std::endl;
|
||||
std::cerr << " Routing events: " << std::endl;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
||||
{
|
||||
@ -209,7 +209,7 @@ bool GRouterMatrix::computeRoutingProbabilities(const GRouterKeyId& key_id, cons
|
||||
{
|
||||
// Routing probabilities are computed according to routing clues
|
||||
//
|
||||
// For a given key, each friend has a known set of routing clues (time_t, weight)
|
||||
// For a given key, each friend has a known set of routing clues (rstime_t, weight)
|
||||
// We combine these to compute a static weight for each friend/key pair.
|
||||
// This is performed in updateRoutingProbabilities()
|
||||
//
|
||||
@ -271,7 +271,7 @@ bool GRouterMatrix::updateRoutingProbabilities()
|
||||
if(!_proba_need_updating)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::map<GRouterKeyId, std::list<RoutingMatrixHitEntry> >::const_iterator it(_routing_clues.begin());it!=_routing_clues.end();++it)
|
||||
{
|
||||
|
@ -39,13 +39,13 @@ struct RoutingMatrixHitEntry
|
||||
{
|
||||
uint32_t friend_id ; // not the full key. Gets too big otherwise!
|
||||
float weight ;
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
|
||||
struct RoutingTrackEntry
|
||||
{
|
||||
RsPeerId friend_id ; // not the full key. Gets too big otherwise!
|
||||
time_t time_stamp ;
|
||||
rstime_t time_stamp ;
|
||||
};
|
||||
|
||||
class GRouterMatrix
|
||||
|
@ -22,7 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <list>
|
||||
#include "pgp/rscertificate.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
@ -56,9 +56,9 @@ static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // cl
|
||||
static const uint32_t GROUTER_MAX_DUPLICATION_FACTOR = 10 ; // max number of duplicates for a given message to keep in the network
|
||||
static const uint32_t GROUTER_MAX_BRANCHING_FACTOR = 3 ; // max number of branches, for locally forwarding items
|
||||
|
||||
static const time_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
||||
static const time_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 60*10 ; // Check for key advertising every 10 minutes
|
||||
static const rstime_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
||||
static const rstime_t RS_GROUTER_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||
static const rstime_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 60*10 ; // Check for key advertising every 10 minutes
|
||||
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 2*86400 ; // Cached items are kept for 48 hours at most.
|
||||
|
||||
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
||||
@ -79,7 +79,7 @@ class FriendTrialRecord
|
||||
{
|
||||
public:
|
||||
RsPeerId friend_id ; // id of the friend
|
||||
time_t time_stamp ; // time of the last tried
|
||||
rstime_t time_stamp ; // time of the last tried
|
||||
float probability ; // probability at which the item was selected
|
||||
uint32_t nb_friends ; // number of friends at the time of sending the item
|
||||
|
||||
@ -108,9 +108,9 @@ public:
|
||||
uint32_t data_status ; // pending, waiting, etc.
|
||||
uint32_t tunnel_status ; // status of tunnel handling.
|
||||
|
||||
time_t received_time_TS ; // time at which the item was originally received
|
||||
time_t last_sent_TS ; // last time the item was sent
|
||||
time_t last_tunnel_request_TS ; // last time tunnels have been asked for this item.
|
||||
rstime_t received_time_TS ; // time at which the item was originally received
|
||||
rstime_t last_sent_TS ; // last time the item was sent
|
||||
rstime_t last_tunnel_request_TS ; // last time tunnels have been asked for this item.
|
||||
uint32_t sending_attempts ; // number of times tunnels have been asked for this peer without success
|
||||
|
||||
GRouterServiceId client_id ; // service ID of the client. Only valid when origin==OwnId
|
||||
@ -125,7 +125,7 @@ public:
|
||||
|
||||
// non serialised data
|
||||
|
||||
time_t data_transaction_TS ;
|
||||
rstime_t data_transaction_TS ;
|
||||
|
||||
static const uint32_t ROUTING_FLAGS_ALLOW_TUNNELS = 0x0001;
|
||||
static const uint32_t ROUTING_FLAGS_ALLOW_FRIENDS = 0x0002;
|
||||
|
@ -218,7 +218,7 @@ p3GRouter::p3GRouter(p3ServiceControl *sc, RsGixs *is)
|
||||
|
||||
int p3GRouter::tick()
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// Sort incoming service data
|
||||
//
|
||||
@ -555,7 +555,7 @@ void GRouterTunnelInfo::addVirtualPeer(const TurtleVirtualPeerId& vpid)
|
||||
|
||||
virtual_peers.insert(vpid) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(first_tunnel_ok_TS == 0) first_tunnel_ok_TS = now ;
|
||||
last_tunnel_ok_TS = now ;
|
||||
@ -760,7 +760,7 @@ void p3GRouter::handleTunnels()
|
||||
}
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
std::vector<std::pair<int,GRouterRoutingInfo*> > priority_list ;
|
||||
|
||||
for(std::map<GRouterMsgPropagationId, GRouterRoutingInfo>::iterator it=_pending_messages.begin();it!=_pending_messages.end();++it)
|
||||
@ -893,7 +893,7 @@ void p3GRouter::routePendingObjects()
|
||||
// Which tunnels are available is handled by handleTunnels()
|
||||
//
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
RS_STACK_MUTEX(grMtx) ;
|
||||
#ifdef GROUTER_DEBUG
|
||||
@ -1220,7 +1220,7 @@ void p3GRouter::locked_collectAvailableFriends(const GRouterKeyId& gxs_id,const
|
||||
|
||||
void p3GRouter::locked_collectAvailableTunnels(const TurtleFileHash& hash,uint32_t total_duplication,std::map<RsPeerId,uint32_t>& tunnel_peers_and_duplication_factors)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
// Now go through available virtual peers. Select the ones that are interesting, and set them as potential destinations.
|
||||
|
||||
@ -1304,7 +1304,7 @@ bool p3GRouter::locked_sendTransactionData(const RsPeerId& pid,const RsGRouterTr
|
||||
void p3GRouter::autoWash()
|
||||
{
|
||||
bool items_deleted = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
std::map<GRouterMsgPropagationId,std::pair<GRouterClientService *,RsGxsId> > failed_msgs ;
|
||||
|
||||
@ -2158,7 +2158,7 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
|
||||
//
|
||||
GRouterRoutingInfo info ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
info.data_item = data_item ;
|
||||
info.receipt_item = NULL ;
|
||||
@ -2368,7 +2368,7 @@ void p3GRouter::debugDump()
|
||||
{
|
||||
RS_STACK_MUTEX(grMtx) ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
grouter_debug() << "Full dump of Global Router state: " << std::endl;
|
||||
grouter_debug() << " Owned keys : " << std::endl;
|
||||
|
@ -68,8 +68,8 @@ public:
|
||||
|
||||
std::set<TurtleVirtualPeerId> virtual_peers ;
|
||||
|
||||
time_t first_tunnel_ok_TS ; // timestamp when 1st tunnel was received.
|
||||
time_t last_tunnel_ok_TS ; // timestamp when last tunnel was received.
|
||||
rstime_t first_tunnel_ok_TS ; // timestamp when 1st tunnel was received.
|
||||
rstime_t last_tunnel_ok_TS ; // timestamp when last tunnel was received.
|
||||
};
|
||||
class GRouterDataInfo
|
||||
{
|
||||
@ -87,7 +87,7 @@ public:
|
||||
RsGRouterAbstractMsgItem *addDataChunk(RsGRouterTransactionChunkItem *chunk_item) ;
|
||||
RsGRouterTransactionChunkItem *incoming_data_buffer ;
|
||||
|
||||
time_t last_activity_TS ;
|
||||
rstime_t last_activity_TS ;
|
||||
};
|
||||
|
||||
class p3GRouter: public RsGRouter, public RsTurtleClientService, public p3Service, public p3Config
|
||||
@ -346,10 +346,10 @@ private:
|
||||
bool _changed ;
|
||||
bool _debug_enabled ;
|
||||
|
||||
time_t _last_autowash_time ;
|
||||
time_t _last_matrix_update_time ;
|
||||
time_t _last_debug_output_time ;
|
||||
time_t _last_config_changed ;
|
||||
rstime_t _last_autowash_time ;
|
||||
rstime_t _last_matrix_update_time ;
|
||||
rstime_t _last_debug_output_time ;
|
||||
rstime_t _last_config_changed ;
|
||||
|
||||
uint64_t _random_salt ;
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ class gxp::Paper
|
||||
std::string serialnumber;
|
||||
std::string url;
|
||||
std::list<std::string> authors;
|
||||
time_t date;
|
||||
rstime_t date;
|
||||
uint32_t startpage;
|
||||
uint32_t endpage;
|
||||
std::string language;
|
||||
|
@ -73,7 +73,7 @@ class gixp::profile
|
||||
gxip::keyref mKeyId;
|
||||
|
||||
std::string mName;
|
||||
time_t mTimestamp; /* superseded by newer timestamps */
|
||||
rstime_t mTimestamp; /* superseded by newer timestamps */
|
||||
uint32_t mProfileType; /* ANONYMOUS (no name, self-signed), PSEUDONYM (self-signed), GPG (name=gpgid, gpgsigned), REVOCATION?? */
|
||||
gpp::permissions mPermissions;
|
||||
|
||||
|
@ -157,7 +157,7 @@ class gdp::interface
|
||||
/* query for available groups & messages */
|
||||
int listgroups(std::list<gdb::id> &grpIds);
|
||||
/* response from listmsgs: -1 = invalid parameters, 0 = incomplete list, 1 = all known msgs */
|
||||
int listmsgs(const gdp::id grpId, std::list<gdb::id> &msgIds, const time_t from, const time_t to, const int maxmsgs);
|
||||
int listmsgs(const gdp::id grpId, std::list<gdb::id> &msgIds, const rstime_t from, const rstime_t to, const int maxmsgs);
|
||||
|
||||
/* response from requestMsg: YES (available immediately), RETRIEVING (known to exist),
|
||||
* IN_REQUEST (might exist), NOT_AVAILABLE (still might exist)
|
||||
@ -239,8 +239,8 @@ class gnp::exchange: public gdp::interface
|
||||
/*** IMPLEMENTATION DETAILS ****/
|
||||
|
||||
/* Get/Send Messages */
|
||||
getAvailableMsgs(gdp::id grpId, time_t from, time_t to); /* request over the network */
|
||||
sendAvailableMsgs(std::string peerId, gdp::id grpId, time_t from, time_t to); /* send to peers */
|
||||
getAvailableMsgs(gdp::id grpId, rstime_t from, rstime_t to); /* request over the network */
|
||||
sendAvailableMsgs(std::string peerId, gdp::id grpId, rstime_t from, rstime_t to); /* send to peers */
|
||||
|
||||
requestMessages(std::string peerId, gdp::id grpId, std::list<gdp::id> msgIds);
|
||||
sendMessages(std::string peerId, gdp::id grpId, std::list<gdp::id> msgIds); /* send to peer, obviously permissions have been checked first */
|
||||
@ -284,7 +284,7 @@ class gixp::profile
|
||||
gxip::keyref mKeyId;
|
||||
|
||||
std::string mPseudonym;
|
||||
time_t mTimestamp; /* superseded by newer timestamps */
|
||||
rstime_t mTimestamp; /* superseded by newer timestamps */
|
||||
uint32_t mProfileType; /* ANONYMOUS (no name, self-signed), PSEUDONYM (self-signed), GPG (name=gpgname, gpgsigned), REVOCATION?? */
|
||||
gpp::permissions mPermissions;
|
||||
|
||||
|
@ -954,7 +954,7 @@ void RsDataService::locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta)
|
||||
|
||||
void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
|
||||
{
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
auto it = mGrpMetaDataCache.find(gid) ;
|
||||
|
||||
// We dont actually delete the item, because it might be used by a calling client.
|
||||
|
@ -345,7 +345,7 @@ private:
|
||||
void locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta);
|
||||
|
||||
std::map<RsGxsGroupId,RsGxsGrpMetaData*> mGrpMetaDataCache ;
|
||||
std::list<std::pair<time_t,RsGxsGrpMetaData*> > mOldCachedItems ;
|
||||
std::list<std::pair<rstime_t,RsGxsGrpMetaData*> > mOldCachedItems ;
|
||||
|
||||
bool mGrpMetaDataCache_ContainsAllDatabase ;
|
||||
};
|
||||
|
@ -88,7 +88,7 @@ struct RsGroupNetworkStats
|
||||
uint32_t mMaxVisibleCount;
|
||||
bool mGrpAutoSync;
|
||||
bool mAllowMsgSync;
|
||||
time_t mLastGroupModificationTS;
|
||||
rstime_t mLastGroupModificationTS;
|
||||
};
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;
|
||||
|
@ -124,7 +124,7 @@ RsGenExchange::~RsGenExchange()
|
||||
mGrpsToPublish.clear();
|
||||
}
|
||||
|
||||
bool RsGenExchange::getGroupServerUpdateTS(const RsGxsGroupId& gid, time_t& grp_server_update_TS, time_t& msg_server_update_TS)
|
||||
bool RsGenExchange::getGroupServerUpdateTS(const RsGxsGroupId& gid, rstime_t& grp_server_update_TS, rstime_t& msg_server_update_TS)
|
||||
{
|
||||
return mNetService->getGroupServerUpdateTS(gid,grp_server_update_TS,msg_server_update_TS) ;
|
||||
}
|
||||
@ -169,7 +169,7 @@ void RsGenExchange::tick()
|
||||
// implemented service tick function
|
||||
service_tick();
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if((mLastClean + MSG_CLEANUP_PERIOD < now) || mCleaning)
|
||||
{
|
||||
@ -259,7 +259,7 @@ bool RsGenExchange::messagePublicationTest(const RsGxsMsgMetaData& meta)
|
||||
|
||||
uint32_t st = mNetService->getKeepAge(meta.mGroupId);
|
||||
|
||||
time_t storageTimeLimit = meta.mPublishTs + st;
|
||||
rstime_t storageTimeLimit = meta.mPublishTs + st;
|
||||
|
||||
return meta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP || st == 0 || storageTimeLimit >= time(NULL);
|
||||
}
|
||||
@ -2140,7 +2140,7 @@ void RsGenExchange::publishMsgs()
|
||||
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// stick back msgs pending signature
|
||||
typedef std::map<uint32_t, GxsPendingItem<RsGxsMsgItem*, uint32_t> > PendSignMap;
|
||||
@ -2561,7 +2561,7 @@ void RsGenExchange::publishGrps()
|
||||
GxsGrpPendingSign& ggps = *vit;
|
||||
|
||||
/* do intial checks to see if this entry has expired */
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
uint32_t token = ggps.mToken;
|
||||
|
||||
|
||||
@ -2869,7 +2869,7 @@ void RsGenExchange::processRecvdMessages()
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if(mMsgPendingValidate.empty())
|
||||
return ;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define RSGENEXCHANGE_H
|
||||
|
||||
#include <queue>
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "rsgxs.h"
|
||||
#include "rsgds.h"
|
||||
@ -39,7 +39,7 @@ template<class GxsItem, typename Identity = std::string>
|
||||
class GxsPendingItem
|
||||
{
|
||||
public:
|
||||
GxsPendingItem(GxsItem item, Identity id,time_t ts) :
|
||||
GxsPendingItem(GxsItem item, Identity id,rstime_t ts) :
|
||||
mItem(item), mId(id), mFirstTryTS(ts)
|
||||
{}
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
|
||||
GxsItem mItem;
|
||||
Identity mId;
|
||||
time_t mFirstTryTS;
|
||||
rstime_t mFirstTryTS;
|
||||
};
|
||||
|
||||
class GxsGrpPendingSign
|
||||
@ -61,7 +61,7 @@ public:
|
||||
mItem(item), mHaveKeys(false), mIsUpdate(false)
|
||||
{}
|
||||
|
||||
time_t mLastAttemptTS, mStartTS;
|
||||
rstime_t mLastAttemptTS, mStartTS;
|
||||
uint32_t mToken;
|
||||
RsGxsGrpItem* mItem;
|
||||
bool mHaveKeys; // mKeys->first == true if key present
|
||||
@ -669,7 +669,7 @@ public:
|
||||
* when needed. Typical use case is forums and circles.
|
||||
* @param gid GroupId the TS is which is requested
|
||||
*/
|
||||
bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
||||
bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) ;
|
||||
|
||||
/*!
|
||||
* \brief getDefaultStoragePeriod. All times in seconds.
|
||||
@ -905,12 +905,12 @@ private:
|
||||
NxsMsgPendingVect mMsgPendingValidate;
|
||||
|
||||
bool mCleaning;
|
||||
time_t mLastClean;
|
||||
rstime_t mLastClean;
|
||||
RsGxsMessageCleanUp* mMsgCleanUp;
|
||||
|
||||
|
||||
bool mChecking, mCheckStarted;
|
||||
time_t mLastCheck;
|
||||
rstime_t mLastCheck;
|
||||
RsGxsIntegrityCheck* mIntegrityCheck;
|
||||
|
||||
protected:
|
||||
|
@ -221,7 +221,7 @@ class RsGcxs
|
||||
|
||||
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsGroupId& destination_group, const RsGxsId& id) = 0;
|
||||
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) =0;
|
||||
};
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ public:
|
||||
:RsGenExchange(gds,ns,serviceSerialiser,mServType, gixs, authenPolicy) { return; }
|
||||
virtual ~RsGxsCircleExchange() { return; }
|
||||
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS)
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS)
|
||||
{
|
||||
return RsGenExchange::getGroupServerUpdateTS(RsGxsGroupId(gid),grp_server_update_TS,msg_server_update_TS) ;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "rsitems/rsgxsitems.h"
|
||||
|
||||
struct RsGroupMetaData;
|
||||
@ -110,7 +110,7 @@ public:
|
||||
|
||||
RsTlvKeySignatureSet signSet;
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
rstime_t mPublishTs;
|
||||
uint32_t mMsgFlags; // used by some services (e.g. by forums to store message moderation flags)
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
@ -119,7 +119,7 @@ public:
|
||||
std::string mServiceString;
|
||||
uint32_t mMsgStatus;
|
||||
uint32_t mMsgSize;
|
||||
time_t mChildTs;
|
||||
rstime_t mChildTs;
|
||||
uint32_t recvTS;
|
||||
RsFileHash mHash;
|
||||
bool validated;
|
||||
|
@ -20,7 +20,7 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "rsgxsutil.h"
|
||||
#include "rsgxsdataaccess.h"
|
||||
@ -317,7 +317,7 @@ RsTokenService::GxsRequestStatus RsGxsDataAccess::requestStatus(uint32_t token)
|
||||
RsTokenService::GxsRequestStatus status;
|
||||
uint32_t reqtype;
|
||||
uint32_t anstype;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mDataMutex);
|
||||
@ -717,7 +717,7 @@ GxsRequest* RsGxsDataAccess::locked_retrieveRequest(const uint32_t& token)
|
||||
void RsGxsDataAccess::processRequests()
|
||||
{
|
||||
std::list<uint32_t> toClear;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
std::map<uint32_t, GxsRequest*>::iterator it;
|
||||
|
||||
{
|
||||
@ -1124,8 +1124,8 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
||||
std::vector<RsGxsMsgMetaData*>::const_iterator vit = metaV.begin();
|
||||
|
||||
// RUN THROUGH ALL MSGS... in map origId -> TS.
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> >::iterator oit;
|
||||
|
||||
for(; vit != metaV.end(); ++vit)
|
||||
{
|
||||
@ -1402,8 +1402,8 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
if (onlyChildMsgs || onlyThreadMsgs)
|
||||
{
|
||||
// RUN THROUGH ALL MSGS... in map origId -> TS.
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> > origMsgTs;
|
||||
std::map<RsGxsMessageId, std::pair<RsGxsMessageId, rstime_t> >::iterator oit;
|
||||
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); ++vit_meta)
|
||||
{
|
||||
|
||||
@ -1472,7 +1472,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
{
|
||||
|
||||
/* first guess is potentially better than Orig (can't be worse!) */
|
||||
time_t latestTs = 0;
|
||||
rstime_t latestTs = 0;
|
||||
RsGxsMessageId latestMsgId;
|
||||
RsGxsMsgMetaData* latestMeta=NULL;
|
||||
|
||||
@ -1760,7 +1760,7 @@ void RsGxsDataAccess::filterGrpList(std::list<RsGxsGroupId> &grpIds, const RsTok
|
||||
|
||||
bool RsGxsDataAccess::checkRequestStatus(
|
||||
uint32_t token, GxsRequestStatus& status, uint32_t& reqtype,
|
||||
uint32_t& anstype, time_t& ts )
|
||||
uint32_t& anstype, rstime_t& ts )
|
||||
{
|
||||
RS_STACK_MUTEX(mDataMutex);
|
||||
|
||||
|
@ -314,7 +314,7 @@ private:
|
||||
* @return false if token does not exist, true otherwise
|
||||
*/
|
||||
bool checkRequestStatus( uint32_t token, GxsRequestStatus &status,
|
||||
uint32_t &reqtype, uint32_t &anstype, time_t &ts);
|
||||
uint32_t &reqtype, uint32_t &anstype, rstime_t &ts);
|
||||
|
||||
// special ones for testing (not in final design)
|
||||
/*!
|
||||
|
@ -327,7 +327,7 @@ static const uint32_t service_to_print = RS_SERVICE_GXS_TYPE_CHANNELS ;
|
||||
|
||||
class nullstream: public std::ostream {};
|
||||
|
||||
static std::string nice_time_stamp(time_t now,time_t TS)
|
||||
static std::string nice_time_stamp(rstime_t now,rstime_t TS)
|
||||
{
|
||||
if(TS == 0)
|
||||
return "Never" ;
|
||||
@ -448,8 +448,8 @@ int RsGxsNetService::tick()
|
||||
if(should_notify)
|
||||
processObserverNotifications() ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t elapsed = mSYNC_PERIOD + mSyncTs;
|
||||
rstime_t now = time(NULL);
|
||||
rstime_t elapsed = mSYNC_PERIOD + mSyncTs;
|
||||
|
||||
if((elapsed) < now)
|
||||
{
|
||||
@ -525,20 +525,20 @@ void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
|
||||
void RsGxsNetService::cleanRejectedMessages()
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG___ << "Cleaning rejected messages." << std::endl;
|
||||
#endif
|
||||
|
||||
for(std::map<RsGxsMessageId,time_t>::iterator it(mRejectedMessages.begin());it!=mRejectedMessages.end();)
|
||||
for(std::map<RsGxsMessageId,rstime_t>::iterator it(mRejectedMessages.begin());it!=mRejectedMessages.end();)
|
||||
if(it->second + REJECTED_MESSAGE_RETRY_DELAY < now)
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
GXSNETDEBUG___ << " message id " << it->first << " should be re-tried. removing from list..." << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<RsGxsMessageId,time_t>::iterator tmp = it ;
|
||||
std::map<RsGxsMessageId,rstime_t>::iterator tmp = it ;
|
||||
++tmp ;
|
||||
mRejectedMessages.erase(it) ;
|
||||
it=tmp ;
|
||||
@ -854,7 +854,7 @@ void RsGxsNetService::syncGrpStatistics()
|
||||
// Go through group statistics and groups without information are re-requested to random peers selected
|
||||
// among the ones who provided the group info.
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(auto it(grpMeta.begin());it!=grpMeta.end();++it)
|
||||
{
|
||||
@ -1591,7 +1591,7 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
|
||||
// The delete is done in StoreHere, if necessary
|
||||
|
||||
std::for_each(load.begin(), load.end(), StoreHere(mClientGrpUpdateMap, mClientMsgUpdateMap, mServerMsgUpdateMap, mServerGrpConfigMap, mGrpServerUpdate));
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// We reset group statistics here. This is the best place since we know at this point which are all unsubscribed groups.
|
||||
|
||||
@ -2018,7 +2018,7 @@ void RsGxsNetService::debugDump()
|
||||
{
|
||||
#ifdef NXS_NET_DEBUG_0
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
//time_t now = time(NULL) ;
|
||||
//rstime_t now = time(NULL) ;
|
||||
|
||||
GXSNETDEBUG___<< "RsGxsNetService::debugDump():" << std::endl;
|
||||
|
||||
@ -2160,8 +2160,8 @@ void RsGxsNetService::updateServerSyncTS()
|
||||
// ask to the GxsNetService of circles what the server TS is for that circle. If more recent, we update the serverTS of the
|
||||
// local group
|
||||
|
||||
time_t circle_group_server_ts ;
|
||||
time_t circle_msg_server_ts ;
|
||||
rstime_t circle_group_server_ts ;
|
||||
rstime_t circle_msg_server_ts ;
|
||||
|
||||
// This call needs to be off-mutex, because of self-restricted circles.
|
||||
// Normally we should update as a function of MsgServerUpdateTS and the mRecvTS of the circle, not the global grpServerTS.
|
||||
@ -2653,7 +2653,7 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
|
||||
GXSNETDEBUG_P_(tr->mTransaction->PeerId()) << " type = msgs." << std::endl;
|
||||
#endif
|
||||
RsGxsGroupId grpId;
|
||||
//time_t now = time(NULL) ;
|
||||
//rstime_t now = time(NULL) ;
|
||||
|
||||
while(tr->mItems.size() > 0)
|
||||
{
|
||||
@ -3106,7 +3106,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||
}
|
||||
}
|
||||
|
||||
void RsGxsNetService::locked_stampPeerGroupUpdateTime(const RsPeerId& pid,const RsGxsGroupId& grpId,time_t tm,uint32_t n_messages)
|
||||
void RsGxsNetService::locked_stampPeerGroupUpdateTime(const RsPeerId& pid,const RsGxsGroupId& grpId,rstime_t tm,uint32_t n_messages)
|
||||
{
|
||||
RsGxsMsgUpdate& up(mClientMsgUpdateMap[pid]);
|
||||
|
||||
@ -4380,7 +4380,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
|
||||
uint32_t transN = locked_getTransactionId();
|
||||
RsGxsCircleId should_encrypt_to_this_circle_id ;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
uint32_t max_send_delay = locked_getGrpConfig(item->grpId).msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one.
|
||||
|
||||
@ -5024,7 +5024,7 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& group_server_update_TS, time_t& msg_server_update_TS)
|
||||
bool RsGxsNetService::getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& group_server_update_TS, rstime_t& msg_server_update_TS)
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
|
||||
@ -5112,7 +5112,7 @@ TurtleRequestId RsGxsNetService::turtleGroupRequest(const RsGxsGroupId& group_id
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
auto it = mSearchedGroups.find(group_id) ;
|
||||
|
||||
if(mSearchedGroups.end() != it && (it->second.ts + MIN_DELAY_BETWEEN_GROUP_SEARCH > now))
|
||||
@ -5309,7 +5309,7 @@ bool RsGxsNetService::search( const std::string& substring,
|
||||
if((rit = uQ.find("signFlags")) != uQ.end())
|
||||
s.mSignFlags = std::stoul(rit->second);
|
||||
if((rit = uQ.find("publishTs")) != uQ.end())
|
||||
s.mPublishTs = static_cast<time_t>(std::stoll(rit->second));
|
||||
s.mPublishTs = static_cast<rstime_t>(std::stoll(rit->second));
|
||||
if((rit = uQ.find("authorId")) != uQ.end())
|
||||
s.mAuthorId = RsGxsId(rit->second);
|
||||
|
||||
|
@ -52,14 +52,14 @@ class RsGroupNetworkStatsRecord
|
||||
|
||||
std::set<RsPeerId> suppliers ;
|
||||
uint32_t max_visible_count ;
|
||||
time_t update_TS ;
|
||||
rstime_t update_TS ;
|
||||
};
|
||||
|
||||
struct GroupRequestRecord
|
||||
{
|
||||
GroupRequestRecord(): ts(0), request_id(0) {}
|
||||
|
||||
time_t ts ;
|
||||
rstime_t ts ;
|
||||
TurtleRequestId request_id;
|
||||
};
|
||||
|
||||
@ -188,7 +188,7 @@ public:
|
||||
|
||||
virtual void rejectMessage(const RsGxsMessageId& msg_id) ;
|
||||
|
||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) ;
|
||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) ;
|
||||
virtual bool stampMsgServerUpdateTS(const RsGxsGroupId& gid) ;
|
||||
virtual bool removeGroups(const std::list<RsGxsGroupId>& groups);
|
||||
virtual bool isDistantPeer(const RsPeerId& pid);
|
||||
@ -507,7 +507,7 @@ private:
|
||||
* stamp the group info from that particular peer at the given time.
|
||||
*/
|
||||
|
||||
void locked_stampPeerGroupUpdateTime(const RsPeerId& pid,const RsGxsGroupId& grpId,time_t tm,uint32_t n_messages) ;
|
||||
void locked_stampPeerGroupUpdateTime(const RsPeerId& pid,const RsGxsGroupId& grpId,rstime_t tm,uint32_t n_messages) ;
|
||||
|
||||
/*!
|
||||
* encrypts/decrypts the transaction for the destination circle id.
|
||||
@ -602,7 +602,7 @@ private:
|
||||
RsGxsServerGrpUpdate mGrpServerUpdate;
|
||||
RsServiceInfo mServiceInfo;
|
||||
|
||||
std::map<RsGxsMessageId,time_t> mRejectedMessages;
|
||||
std::map<RsGxsMessageId,rstime_t> mRejectedMessages;
|
||||
|
||||
std::vector<RsNxsGrp*> mNewGroupsToNotify ;
|
||||
std::vector<RsNxsMsg*> mNewMessagesToNotify ;
|
||||
@ -620,7 +620,7 @@ private:
|
||||
std::map<Sha1CheckSum, RsNxsGrp*> mGroupHashCache;
|
||||
std::map<TurtleRequestId,RsGxsGroupId> mSearchRequests;
|
||||
std::map<RsGxsGroupId,GroupRequestRecord> mSearchedGroups ;
|
||||
time_t mLastCacheReloadTS ;
|
||||
rstime_t mLastCacheReloadTS ;
|
||||
};
|
||||
|
||||
#endif // RSGXSNETSERVICE_H
|
||||
|
@ -732,7 +732,7 @@ void RsGxsNetTunnelService::data_tick()
|
||||
mPendingTurtleItems.pop_front();
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
// cleanup
|
||||
|
||||
|
@ -270,8 +270,8 @@ private:
|
||||
friend class RsGxsTunnelRandomBiasItem ;
|
||||
friend class StoreHere ;
|
||||
|
||||
time_t mLastKeepAlive ;
|
||||
time_t mLastAutoWash ;
|
||||
time_t mLastDump ;
|
||||
rstime_t mLastKeepAlive ;
|
||||
rstime_t mLastAutoWash ;
|
||||
rstime_t mLastDump ;
|
||||
};
|
||||
|
||||
|
@ -24,11 +24,11 @@
|
||||
#include "pqi/p3servicecontrol.h"
|
||||
#include "pgp/pgpauxutils.h"
|
||||
|
||||
const time_t AuthorPending::EXPIRY_PERIOD_OFFSET = 30; // 30 seconds
|
||||
const rstime_t AuthorPending::EXPIRY_PERIOD_OFFSET = 30; // 30 seconds
|
||||
const int AuthorPending::MSG_PEND = 1;
|
||||
const int AuthorPending::GRP_PEND = 2;
|
||||
|
||||
AuthorPending::AuthorPending(RsGixsReputation* rep, time_t timeStamp) : mRep(rep), mTimeStamp(timeStamp) {}
|
||||
AuthorPending::AuthorPending(RsGixsReputation* rep, rstime_t timeStamp) : mRep(rep), mTimeStamp(timeStamp) {}
|
||||
|
||||
AuthorPending::~AuthorPending() {}
|
||||
|
||||
@ -197,7 +197,7 @@ void RsNxsNetMgrImpl::getOnlineList(const uint32_t serviceId, std::set<RsPeerId>
|
||||
mServiceCtrl->getPeersConnected(serviceId, ssl_peers);
|
||||
}
|
||||
|
||||
const time_t GrpCircleVetting::EXPIRY_PERIOD_OFFSET = 5; // 10 seconds
|
||||
const rstime_t GrpCircleVetting::EXPIRY_PERIOD_OFFSET = 5; // 10 seconds
|
||||
const int GrpCircleVetting::GRP_ID_PEND = 1;
|
||||
const int GrpCircleVetting::GRP_ITEM_PEND = 2;
|
||||
const int GrpCircleVetting::MSG_ID_SEND_PEND = 3;
|
||||
|
@ -114,9 +114,9 @@ public:
|
||||
|
||||
static const int MSG_PEND;
|
||||
static const int GRP_PEND;
|
||||
static const time_t EXPIRY_PERIOD_OFFSET;
|
||||
static const rstime_t EXPIRY_PERIOD_OFFSET;
|
||||
|
||||
AuthorPending(RsGixsReputation* rep, time_t timeStamp);
|
||||
AuthorPending(RsGixsReputation* rep, rstime_t timeStamp);
|
||||
virtual ~AuthorPending();
|
||||
virtual int getType() const = 0 ;
|
||||
|
||||
@ -144,7 +144,7 @@ protected:
|
||||
private:
|
||||
|
||||
RsGixsReputation* mRep;
|
||||
time_t mTimeStamp;
|
||||
rstime_t mTimeStamp;
|
||||
};
|
||||
|
||||
class MsgAuthEntry
|
||||
@ -237,7 +237,7 @@ class GrpCircleVetting
|
||||
{
|
||||
public:
|
||||
|
||||
static const time_t EXPIRY_PERIOD_OFFSET;
|
||||
static const rstime_t EXPIRY_PERIOD_OFFSET;
|
||||
static const int GRP_ID_PEND;
|
||||
static const int GRP_ITEM_PEND;
|
||||
static const int MSG_ID_SEND_PEND;
|
||||
@ -255,7 +255,7 @@ protected:
|
||||
|
||||
RsGcxs* const mCircles;
|
||||
PgpAuxUtils *mPgpUtils;
|
||||
time_t mTimeStamp;
|
||||
rstime_t mTimeStamp;
|
||||
};
|
||||
|
||||
class GrpCircleIdRequestVetting : public GrpCircleVetting
|
||||
|
@ -21,7 +21,7 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "rsgxsutil.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
@ -57,7 +57,7 @@ bool RsGxsMessageCleanUp::clean()
|
||||
{
|
||||
uint32_t i = 1;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
uint16_t service_type = mGenExchangeClient->serviceType() ;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <stdlib.h>
|
||||
#include <list>
|
||||
#include <map>
|
||||
@ -220,7 +220,7 @@ public:
|
||||
* \param tm time stamp computed
|
||||
* \return false if the group is not found, true otherwise
|
||||
*/
|
||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) =0;
|
||||
virtual bool getGroupServerUpdateTS(const RsGxsGroupId& gid,rstime_t& grp_server_update_TS,rstime_t& msg_server_update_TS) =0;
|
||||
|
||||
/*!
|
||||
* \brief stampMsgServerUpdateTS
|
||||
|
@ -482,7 +482,7 @@ void p3GxsTrans::service_tick()
|
||||
{
|
||||
GxsTokenQueue::checkRequests();
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
bool changed = false ;
|
||||
|
||||
if(mLastMsgCleanup + MAX_DELAY_BETWEEN_CLEANUPS < now)
|
||||
|
@ -175,7 +175,7 @@ private:
|
||||
*/
|
||||
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS ; // every 20 mins. Could be less.
|
||||
|
||||
time_t mLastMsgCleanup ;
|
||||
rstime_t mLastMsgCleanup ;
|
||||
|
||||
/// Define how the backend should handle authentication based on signatures
|
||||
static uint32_t AuthenPolicy();
|
||||
@ -272,8 +272,8 @@ private:
|
||||
|
||||
/** @return true if has passed more then interval seconds between timeStamp
|
||||
* and ref. @param ref by default now is taked as reference. */
|
||||
bool static inline olderThen(time_t timeStamp, int32_t interval,
|
||||
time_t ref = time(NULL))
|
||||
bool static inline olderThen(rstime_t timeStamp, int32_t interval,
|
||||
rstime_t ref = time(NULL))
|
||||
{ return (timeStamp + interval) < ref; }
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "util/rsurl.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
// Generated at compile time
|
||||
#include "jsonapi-includes.inl"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include "util/rstime.h"
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
|
@ -601,8 +601,8 @@ const ops_keydata_t *PGPHandler::locked_getPublicKey(const RsPgpId& id,bool stam
|
||||
{
|
||||
if(stamp_the_key) // Should we stamp the key as used?
|
||||
{
|
||||
static time_t last_update_db_because_of_stamp = 0 ;
|
||||
time_t now = time(NULL) ;
|
||||
static rstime_t last_update_db_because_of_stamp = 0 ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
res->second._time_stamp = now ;
|
||||
|
||||
|
@ -57,7 +57,7 @@ class PGPCertificateInfo
|
||||
uint32_t _flags ;
|
||||
uint32_t _type ;
|
||||
|
||||
mutable time_t _time_stamp ; // last time the key was used (received, used for signature verification, etc)
|
||||
mutable rstime_t _time_stamp ; // last time the key was used (received, used for signature verification, etc)
|
||||
|
||||
PGPFingerprintType _fpr; /* fingerprint */
|
||||
// RsPgpId _key_id ;
|
||||
@ -220,9 +220,9 @@ class PGPHandler
|
||||
bool _pubring_changed ;
|
||||
mutable bool _trustdb_changed ;
|
||||
|
||||
time_t _pubring_last_update_time ;
|
||||
time_t _secring_last_update_time ;
|
||||
time_t _trustdb_last_update_time ;
|
||||
rstime_t _pubring_last_update_time ;
|
||||
rstime_t _secring_last_update_time ;
|
||||
rstime_t _trustdb_last_update_time ;
|
||||
|
||||
// Helper functions.
|
||||
//
|
||||
|
@ -297,7 +297,7 @@ bool RsCertificate::initFromString(const std::string& instr,uint32_t& err_code)
|
||||
unsigned char *buf2 = buf;
|
||||
uint32_t s = PGPKeyParser::read_125Size(buf);
|
||||
|
||||
total_s += 1 + ((unsigned long)buf-(unsigned long)buf2) ;
|
||||
total_s += 1 + ((size_t)buf-(size_t)buf2) ;
|
||||
|
||||
if(total_s > size)
|
||||
{
|
||||
|
@ -421,7 +421,7 @@ RsServiceControl *RsPluginManager::getServiceControl() const
|
||||
assert(_service_control);
|
||||
return _service_control ;
|
||||
}
|
||||
void RsPluginManager::slowTickPlugins(time_t seconds)
|
||||
void RsPluginManager::slowTickPlugins(rstime_t seconds)
|
||||
{
|
||||
for(uint32_t i=0;i<_plugins.size();++i)
|
||||
if(_plugins[i].plugin != NULL && _plugins[i].plugin->rs_cache_service() != NULL && (seconds % _plugins[i].plugin->rs_cache_service()->tickDelay() ))
|
||||
|
@ -78,7 +78,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
|
||||
virtual void enablePlugin(const RsFileHash& hash) ;
|
||||
virtual void disablePlugin(const RsFileHash &hash) ;
|
||||
|
||||
virtual void slowTickPlugins(time_t sec) ;
|
||||
virtual void slowTickPlugins(rstime_t sec) ;
|
||||
virtual const std::string& getLocalCacheDir() const ;
|
||||
virtual const std::string& getRemoteCacheDir() const ;
|
||||
virtual RsServiceControl *getServiceControl() const ;
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
//#define DEBUG_AUTHGPG 1
|
||||
|
||||
//const time_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
|
||||
//const rstime_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
|
||||
|
||||
AuthGPG *AuthGPG::_instance = NULL ;
|
||||
|
||||
|
@ -288,7 +288,7 @@ public:
|
||||
RsMutex gpgMtxData;
|
||||
/* Below is protected via the mutex */
|
||||
|
||||
time_t mStoreKeyTime;
|
||||
rstime_t mStoreKeyTime;
|
||||
|
||||
RsPgpId mOwnGpgId;
|
||||
bool gpgKeySelected;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <iomanip>
|
||||
#include <stdio.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "pqi/p3dhtmgr.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
@ -322,7 +322,7 @@ bool p3DhtMgr::notifyPeer(const RsPeerId& id)
|
||||
}
|
||||
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
if (now - it->second.notifyTS < 2 * DHT_NOTIFY_PERIOD)
|
||||
{
|
||||
@ -578,7 +578,7 @@ void p3DhtMgr::run()
|
||||
int p3DhtMgr::checkOwnDHTKeys()
|
||||
{
|
||||
int repubPeriod = 10000;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* in order of importance:
|
||||
* (1) Check for Own Key publish.
|
||||
@ -777,12 +777,12 @@ int p3DhtMgr::checkPeerDHTKeys()
|
||||
|
||||
/* iterate through and find min time and suitable candidate */
|
||||
std::map<RsPeerId, dhtPeerEntry>::iterator it,pit;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
uint32_t period = 0;
|
||||
uint32_t repeatPeriod = 6000;
|
||||
|
||||
pit = peers.end();
|
||||
time_t pTS = now;
|
||||
rstime_t pTS = now;
|
||||
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
@ -792,7 +792,7 @@ int p3DhtMgr::checkPeerDHTKeys()
|
||||
continue;
|
||||
}
|
||||
|
||||
time_t delta = now - it->second.lastTS;
|
||||
rstime_t delta = now - it->second.lastTS;
|
||||
if (it->second.state < DHT_PEER_FOUND)
|
||||
{
|
||||
period = DHT_SEARCH_PERIOD;
|
||||
@ -866,7 +866,7 @@ int p3DhtMgr::checkNotifyDHT()
|
||||
|
||||
/* iterate through and find min time and suitable candidate */
|
||||
std::map<RsPeerId, dhtPeerEntry>::iterator it;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
int repeatPeriod = DHT_DEFAULT_PERIOD;
|
||||
|
||||
/* find the first with a notify flag */
|
||||
@ -1084,7 +1084,7 @@ bool p3DhtMgr::getDhtBootstrapList()
|
||||
#endif
|
||||
dhtMtx.lock(); /* LOCK MUTEX */
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
if (now - mLastBootstrapListTS < DHT_MIN_BOOTSTRAP_REQ_PERIOD)
|
||||
{
|
||||
#ifdef DHT_DEBUG
|
||||
@ -1623,7 +1623,7 @@ bool p3DhtMgr::dhtResultNotify(std::string idhash)
|
||||
std::cerr << RsUtil::BinToHex(idhash) << std::endl;
|
||||
#endif
|
||||
std::map<RsPeerId, dhtPeerEntry>::iterator it;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* if notify - we must match on the second hash */
|
||||
for(it = peers.begin(); (it != peers.end()) && ((it->second).hash2 != idhash); it++) ;
|
||||
@ -1679,7 +1679,7 @@ bool p3DhtMgr::dhtResultSearch(std::string idhash,
|
||||
bool doCb = false;
|
||||
bool doStun = false;
|
||||
uint32_t stunFlags = 0;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
dhtPeerEntry ent;
|
||||
|
||||
|
@ -80,10 +80,10 @@ class dhtPeerEntry
|
||||
|
||||
RsPeerId id;
|
||||
uint32_t state;
|
||||
time_t lastTS;
|
||||
rstime_t lastTS;
|
||||
|
||||
uint32_t notifyPending;
|
||||
time_t notifyTS;
|
||||
rstime_t notifyTS;
|
||||
|
||||
struct sockaddr_in laddr, raddr;
|
||||
uint32_t type; /* ADDR_TYPE as defined above */
|
||||
@ -231,17 +231,17 @@ std::string randomBootstrapId();
|
||||
bool mDhtModifications; /* any user requests? */
|
||||
|
||||
dhtPeerEntry ownEntry;
|
||||
time_t ownNotifyTS;
|
||||
rstime_t ownNotifyTS;
|
||||
std::map<RsPeerId, dhtPeerEntry> peers;
|
||||
|
||||
std::list<std::string> stunIds;
|
||||
bool mStunRequired;
|
||||
|
||||
uint32_t mDhtState;
|
||||
time_t mDhtActiveTS;
|
||||
rstime_t mDhtActiveTS;
|
||||
|
||||
bool mBootstrapAllowed;
|
||||
time_t mLastBootstrapListTS;
|
||||
rstime_t mLastBootstrapListTS;
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include "p3historymgr.h"
|
||||
#include "rsitems/rshistoryitems.h"
|
||||
@ -68,7 +68,7 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
{
|
||||
uint32_t addMsgId = 0;
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(mLastCleanTime + MSG_HISTORY_CLEANING_PERIOD < now)
|
||||
{
|
||||
@ -170,7 +170,7 @@ void p3HistoryMgr::cleanOldMessages()
|
||||
#ifdef HISTMGR_DEBUG
|
||||
std::cerr << "****** cleaning old messages." << std::endl;
|
||||
#endif
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
bool changed = false ;
|
||||
|
||||
for(std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.begin(); mit != mMessages.end();)
|
||||
|
@ -88,7 +88,7 @@ private:
|
||||
uint32_t mPrivateSaveCount;
|
||||
|
||||
uint32_t mMaxStorageDurationSeconds ;
|
||||
time_t mLastCleanTime ;
|
||||
rstime_t mLastCleanTime ;
|
||||
|
||||
std::list<RsItem*> saveCleanupList; /* TEMPORARY LIST WHEN SAVING */
|
||||
|
||||
|
@ -327,9 +327,9 @@ void p3LinkMgrIMPL::statusTick()
|
||||
//std::list<std::string> dummyToRemove;
|
||||
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t oldavail = now - MAX_AVAIL_PERIOD;
|
||||
time_t retry = now - mRetryPeriod;
|
||||
rstime_t now = time(NULL);
|
||||
rstime_t oldavail = now - MAX_AVAIL_PERIOD;
|
||||
rstime_t retry = now - mRetryPeriod;
|
||||
|
||||
RsStackMutex stack(mLinkMtx); /****** LOCK MUTEX ******/
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
@ -1080,7 +1080,7 @@ void p3LinkMgrIMPL::peerStatus(const RsPeerId& id, const pqiIpAddrSet &addrs,
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
bool isFriend = true;
|
||||
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
peerAddrInfo details;
|
||||
details.type = type;
|
||||
@ -1658,7 +1658,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const RsPeerId &id)
|
||||
|
||||
#define MAX_TCP_ADDR_AGE (3600 * 24 * 14) // two weeks in seconds.
|
||||
|
||||
bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &addr, time_t age)
|
||||
bool p3LinkMgrIMPL::locked_CheckPotentialAddr(const struct sockaddr_storage &addr, rstime_t age)
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
std::cerr << "p3LinkMgrIMPL::locked_CheckPotentialAddr(";
|
||||
@ -1805,7 +1805,7 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_HistoricalAddresses(peerConnectState
|
||||
/* now try historical addresses */
|
||||
/* try local addresses first */
|
||||
std::list<pqiIpAddress>::const_iterator ait;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
#ifdef LINKMGR_DEBUG
|
||||
std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_HistoricalAddresses()";
|
||||
@ -2206,7 +2206,7 @@ void p3LinkMgrIMPL::printPeerLists(std::ostream &out)
|
||||
return;
|
||||
}
|
||||
|
||||
bool p3LinkMgrIMPL::checkPotentialAddr(const sockaddr_storage &addr, time_t age)
|
||||
bool p3LinkMgrIMPL::checkPotentialAddr(const sockaddr_storage &addr, rstime_t age)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "pqi/pqimonitor.h"
|
||||
#include "pqi/pqiipset.h"
|
||||
|
||||
#include "util/rstime.h"
|
||||
#include "pqi/pqiassist.h"
|
||||
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
@ -61,7 +61,7 @@ class peerAddrInfo
|
||||
bool found;
|
||||
uint32_t type;
|
||||
pqiIpAddrSet addrs;
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
};
|
||||
|
||||
class peerConnectAddress
|
||||
@ -74,7 +74,7 @@ class peerConnectAddress
|
||||
uint32_t period; /* UDP only */
|
||||
uint32_t type;
|
||||
uint32_t flags; /* CB FLAGS defined in pqimonitor.h */
|
||||
time_t ts;
|
||||
rstime_t ts;
|
||||
|
||||
// Extra Parameters for Relay connections.
|
||||
struct sockaddr_storage proxyaddr;
|
||||
@ -99,8 +99,8 @@ class peerConnectState
|
||||
|
||||
uint32_t connecttype; // RS_NET_CONN_TCP_ALL / RS_NET_CONN_UDP_ALL
|
||||
bool actAsServer;
|
||||
time_t lastavailable;
|
||||
time_t lastattempt;
|
||||
rstime_t lastavailable;
|
||||
rstime_t lastattempt;
|
||||
|
||||
std::string name;
|
||||
|
||||
@ -122,7 +122,7 @@ class peerConnectState
|
||||
|
||||
/* information about denial */
|
||||
bool wasDeniedConnection;
|
||||
time_t deniedTS;
|
||||
rstime_t deniedTS;
|
||||
bool deniedInConnAttempt; /* is below valid */
|
||||
peerConnectAddress deniedConnectionAttempt;
|
||||
};
|
||||
@ -182,7 +182,7 @@ virtual bool getLocalAddress(struct sockaddr_storage &addr) = 0;
|
||||
virtual void getFriendList(std::list<RsPeerId> &ssl_peers) = 0; // ONLY used by p3peers.cc USE p3PeerMgr instead.
|
||||
virtual bool getFriendNetStatus(const RsPeerId &id, peerConnectState &state) = 0; // ONLY used by p3peers.cc
|
||||
|
||||
virtual bool checkPotentialAddr(const struct sockaddr_storage &addr, time_t age)=0;
|
||||
virtual bool checkPotentialAddr(const struct sockaddr_storage &addr, rstime_t age)=0;
|
||||
|
||||
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
||||
virtual int addFriend(const RsPeerId &ssl_id, bool isVisible) = 0;
|
||||
@ -269,7 +269,7 @@ int removeFriend(const RsPeerId &ssl_id);
|
||||
|
||||
void printPeerLists(std::ostream &out);
|
||||
|
||||
virtual bool checkPotentialAddr(const struct sockaddr_storage &addr, time_t age);
|
||||
virtual bool checkPotentialAddr(const struct sockaddr_storage &addr, rstime_t age);
|
||||
protected:
|
||||
/* THESE CAN PROBABLY BE REMOVED */
|
||||
//bool shutdown(); /* blocking shutdown call */
|
||||
@ -302,7 +302,7 @@ void locked_ConnectAttempt_ProxyAddress(peerConnectState *peer, const uint32_t
|
||||
|
||||
bool locked_ConnectAttempt_Complete(peerConnectState *peer);
|
||||
|
||||
bool locked_CheckPotentialAddr(const struct sockaddr_storage &addr, time_t age);
|
||||
bool locked_CheckPotentialAddr(const struct sockaddr_storage &addr, rstime_t age);
|
||||
bool addAddressIfUnique(std::list<peerConnectAddress> &addrList, peerConnectAddress &pca, bool pushFront);
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include <vector>
|
||||
|
||||
#include "pqi/p3netmgr.h"
|
||||
@ -415,7 +415,7 @@ void p3NetMgrIMPL::netStartup()
|
||||
|
||||
void p3NetMgrIMPL::tick()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
bool doSlowTick = false;
|
||||
{
|
||||
RsStackMutex stack(mNetMtx); /************** LOCK MUTEX ***************/
|
||||
@ -474,7 +474,7 @@ void p3NetMgrIMPL::netTick()
|
||||
checkNetAddress() ;
|
||||
|
||||
uint32_t netStatus = 0;
|
||||
time_t age = 0;
|
||||
rstime_t age = 0;
|
||||
{
|
||||
RsStackMutex stack(mNetMtx); /************** LOCK MUTEX ***************/
|
||||
|
||||
@ -605,7 +605,7 @@ void p3NetMgrIMPL::netUpnpCheck()
|
||||
/* grab timestamp */
|
||||
mNetMtx.lock(); /* LOCK MUTEX */
|
||||
|
||||
time_t delta = time(NULL) - mNetInitTS;
|
||||
rstime_t delta = time(NULL) - mNetInitTS;
|
||||
|
||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||
std::cerr << "p3NetMgrIMPL::netUpnpCheck() age: " << delta << std::endl;
|
||||
@ -616,8 +616,8 @@ void p3NetMgrIMPL::netUpnpCheck()
|
||||
struct sockaddr_storage extAddr;
|
||||
int upnpState = netAssistFirewallActive();
|
||||
|
||||
if (((upnpState == 0) && (delta > (time_t)MAX_UPNP_INIT)) ||
|
||||
((upnpState > 0) && (delta > (time_t)MAX_UPNP_COMPLETE)))
|
||||
if (((upnpState == 0) && (delta > (rstime_t)MAX_UPNP_INIT)) ||
|
||||
((upnpState > 0) && (delta > (rstime_t)MAX_UPNP_COMPLETE)))
|
||||
{
|
||||
#if defined(NETMGR_DEBUG_TICK) || defined(NETMGR_DEBUG_RESET)
|
||||
std::cerr << "p3NetMgrIMPL::netUpnpCheck() ";
|
||||
|
@ -334,7 +334,7 @@ void netStatusReset_locked();
|
||||
uint16_t mVsDisc;
|
||||
uint16_t mVsDht;
|
||||
|
||||
time_t mNetInitTS;
|
||||
rstime_t mNetInitTS;
|
||||
uint32_t mNetStatus;
|
||||
|
||||
bool mStatusChanged;
|
||||
@ -349,7 +349,7 @@ void netStatusReset_locked();
|
||||
// Improved NetStatusBox, which uses the Stunners!
|
||||
pqiNetStateBox mNetStateBox;
|
||||
|
||||
time_t mLastSlowTickTime;
|
||||
rstime_t mLastSlowTickTime;
|
||||
uint32_t mOldNatType;
|
||||
uint32_t mOldNatHole;
|
||||
|
||||
|
@ -289,11 +289,11 @@ bool p3PeerMgrIMPL::setOwnVisState(uint16_t vs_disc, uint16_t vs_dht)
|
||||
|
||||
void p3PeerMgrIMPL::tick()
|
||||
{
|
||||
static const time_t INTERVAL_BETWEEN_LOCATION_CLEANING = 300 ; // Remove unused locations and clean IPs every 10 minutes.
|
||||
static const rstime_t INTERVAL_BETWEEN_LOCATION_CLEANING = 300 ; // Remove unused locations and clean IPs every 10 minutes.
|
||||
|
||||
static time_t last_friends_check = time(NULL) ; // first cleaning after 1 hour.
|
||||
static rstime_t last_friends_check = time(NULL) ; // first cleaning after 1 hour.
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now > INTERVAL_BETWEEN_LOCATION_CLEANING + last_friends_check )
|
||||
{
|
||||
@ -900,7 +900,7 @@ bool p3PeerMgrIMPL::haveOnceConnected()
|
||||
/*******************************************************************/
|
||||
/*******************************************************************/
|
||||
|
||||
bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg_id, uint32_t netMode, uint16_t vs_disc, uint16_t vs_dht, time_t lastContact,ServicePermissionFlags service_flags)
|
||||
bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg_id, uint32_t netMode, uint16_t vs_disc, uint16_t vs_dht, rstime_t lastContact,ServicePermissionFlags service_flags)
|
||||
{
|
||||
bool notifyLinkMgr = false;
|
||||
RsPeerId id = input_id ;
|
||||
@ -1718,7 +1718,7 @@ bool p3PeerMgrIMPL::getExtAddressReportedByFriends(sockaddr_storage &addr, uint8
|
||||
static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr)
|
||||
{
|
||||
bool changed = false ;
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
for(std::list<pqiIpAddress>::iterator it2(lst.begin());it2 != lst.end();)
|
||||
{
|
||||
@ -2963,9 +2963,9 @@ bool p3PeerMgrIMPL::removeBannedIps()
|
||||
bool p3PeerMgrIMPL::removeUnusedLocations()
|
||||
{
|
||||
std::list<RsPeerId> toRemove;
|
||||
std::map<RsPgpId, time_t> mostRecentTime;
|
||||
std::map<RsPgpId, rstime_t> mostRecentTime;
|
||||
|
||||
const time_t now = time(NULL);
|
||||
const rstime_t now = time(NULL);
|
||||
|
||||
std::list<RsPgpId> pgpList ;
|
||||
|
||||
@ -2978,7 +2978,7 @@ bool p3PeerMgrIMPL::removeUnusedLocations()
|
||||
// First put a sensible number in all PGP ids
|
||||
|
||||
for(std::list<RsPgpId>::const_iterator it = pgpList.begin(); it != pgpList.end(); ++it)
|
||||
mostRecentTime[*it] = (time_t)0;
|
||||
mostRecentTime[*it] = (rstime_t)0;
|
||||
|
||||
#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgr::removeUnusedLocations()" << std::endl;
|
||||
@ -2987,7 +2987,7 @@ bool p3PeerMgrIMPL::removeUnusedLocations()
|
||||
|
||||
for( std::map<RsPeerId, peerState>::iterator it = mFriendList.begin(); it != mFriendList.end(); ++it)
|
||||
{
|
||||
time_t& bst(mostRecentTime[it->second.gpg_id]) ;
|
||||
rstime_t& bst(mostRecentTime[it->second.gpg_id]) ;
|
||||
bst = std::max(bst,it->second.lastcontact) ;
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ const uint32_t RS_NET_FLAGS_TRUSTS_ME = 0x0020;
|
||||
* remove locations offline since 90 days
|
||||
* stopt sending locations via discovery when offline for +30 days
|
||||
*/
|
||||
const time_t RS_PEER_OFFLINE_DELETE = (90 * 24 * 3600);
|
||||
const time_t RS_PEER_OFFLINE_NO_DISC = (30 * 24 * 3600);
|
||||
const rstime_t RS_PEER_OFFLINE_DELETE = (90 * 24 * 3600);
|
||||
const rstime_t RS_PEER_OFFLINE_NO_DISC = (30 * 24 * 3600);
|
||||
|
||||
class peerState
|
||||
{
|
||||
@ -85,7 +85,7 @@ class peerState
|
||||
struct sockaddr_storage serveraddr;
|
||||
std::string dyndns;
|
||||
|
||||
time_t lastcontact;
|
||||
rstime_t lastcontact;
|
||||
|
||||
/* list of addresses from various sources */
|
||||
pqiIpAddrSet ipAddrs;
|
||||
@ -124,7 +124,7 @@ public:
|
||||
uint32_t netMode = RS_NET_MODE_UDP,
|
||||
uint16_t vsDisc = RS_VS_DISC_FULL,
|
||||
uint16_t vsDht = RS_VS_DHT_FULL,
|
||||
time_t lastContact = 0,
|
||||
rstime_t lastContact = 0,
|
||||
ServicePermissionFlags = ServicePermissionFlags(RS_NODE_PERM_DEFAULT) ) = 0;
|
||||
|
||||
virtual bool removeFriend(const RsPeerId &ssl_id, bool removePgpId) = 0;
|
||||
@ -241,7 +241,7 @@ public:
|
||||
|
||||
virtual bool addFriend(const RsPeerId&ssl_id, const RsPgpId&gpg_id, uint32_t netMode = RS_NET_MODE_UDP,
|
||||
uint16_t vsDisc = RS_VS_DISC_FULL, uint16_t vsDht = RS_VS_DHT_FULL,
|
||||
time_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_NODE_PERM_DEFAULT));
|
||||
rstime_t lastContact = 0,ServicePermissionFlags = ServicePermissionFlags(RS_NODE_PERM_DEFAULT));
|
||||
virtual bool removeFriend(const RsPeerId &ssl_id, bool removePgpId);
|
||||
virtual bool removeFriend(const RsPgpId &pgp_id);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "pqi/pqi_base.h"
|
||||
#include "pqi/pqihash.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -227,7 +228,7 @@ virtual RsFileHash gethash();
|
||||
bool dummyConnected;
|
||||
bool toConnect;
|
||||
uint32_t connectDelta;
|
||||
time_t connectTS;
|
||||
rstime_t connectTS;
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "pqi/pqihandler.h"
|
||||
|
||||
#include <stdlib.h> // for NULL
|
||||
#include <time.h> // for time, time_t
|
||||
#include "util/rstime.h" // for time, rstime_t
|
||||
#include <algorithm> // for sort
|
||||
#include <iostream> // for dec
|
||||
#include <string> // for string, char_traits, operator+, bas...
|
||||
@ -121,7 +121,7 @@ int pqihandler::tick()
|
||||
#endif
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
rstime_t now = time(NULL) ;
|
||||
|
||||
if(now > mLastRateCapUpdate + 5)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define MRK_PQI_HANDLER_HEADER
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <time.h> // for time_t, NULL
|
||||
#include "util/rstime.h" // for rstime_t, NULL
|
||||
#include <list> // for list
|
||||
#include <map> // for map
|
||||
|
||||
@ -121,8 +121,8 @@ protected:
|
||||
float rateTotal_out;
|
||||
|
||||
uint32_t nb_ticks ;
|
||||
time_t last_m ;
|
||||
time_t mLastRateCapUpdate ;
|
||||
rstime_t last_m ;
|
||||
rstime_t mLastRateCapUpdate ;
|
||||
float ticks_per_sec ;
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#include <time.h>
|
||||
#include "util/rstime.h"
|
||||
#include "pqi/pqiipset.h"
|
||||
#include "util/rsstring.h"
|
||||
|
||||
@ -193,7 +193,7 @@ void pqiIpAddrList::loadTlv(RsTlvIpAddrSet &tlvAddrs) const
|
||||
void pqiIpAddrList::printIpAddressList(std::string &out) const
|
||||
{
|
||||
std::list<pqiIpAddress>::const_iterator it;
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
for(it = mAddrs.begin(); it != mAddrs.end(); ++it)
|
||||
{
|
||||
out += sockaddr_storage_tostring(it->mAddr);
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "util/rsnet.h"
|
||||
#include "serialiser/rstlvaddrs.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#define MAX_ADDRESS_LIST_SIZE 10
|
||||
|
||||
@ -34,7 +35,7 @@ class pqiIpAddress
|
||||
bool validAddress() const;
|
||||
|
||||
struct sockaddr_storage mAddr;
|
||||
time_t mSeenTime;
|
||||
rstime_t mSeenTime;
|
||||
uint32_t mSrc;
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "util/rsnet.h"
|
||||
#include "pqi/pqinetstatebox.h"
|
||||
#include "time.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#ifdef RS_USE_BITDHT
|
||||
#include "bitdht/bdiface.h"
|
||||
@ -191,7 +191,7 @@ void pqiNetStateBox::reset()
|
||||
{
|
||||
|
||||
mStatusOkay = false;
|
||||
//time_t mStatusTS;
|
||||
//rstime_t mStatusTS;
|
||||
|
||||
mNetworkMode = RSNET_NETWORK_UNKNOWN;
|
||||
mNatTypeMode = RSNET_NATTYPE_UNKNOWN;
|
||||
@ -244,7 +244,7 @@ int pqiNetStateBox::statusOkay()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
if (now - mStatusTS > NETSTATE_TIMEOUT)
|
||||
{
|
||||
return 0;
|
||||
@ -268,7 +268,7 @@ void pqiNetStateBox::clearOldNetworkData()
|
||||
{
|
||||
#ifdef RS_USE_DHT_STUNNER
|
||||
/* check if any measurements are too old to consider */
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
if (now - mStunProxyTS > NETSTATE_PARAM_TIMEOUT)
|
||||
{
|
||||
mStunProxySet = false;
|
||||
@ -292,7 +292,7 @@ void pqiNetStateBox::clearOldNetworkData()
|
||||
void pqiNetStateBox::determineNetworkState()
|
||||
{
|
||||
clearOldNetworkData();
|
||||
time_t now = time(NULL);
|
||||
rstime_t now = time(NULL);
|
||||
|
||||
/* now we use the remaining valid input to determine network state */
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user