mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 12:24:24 -04:00
improvements to global router: longer half-life for routing events, re-sending of un-delivered items, removed unused constants, added missing file to .pro
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8148 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
69612c0c86
commit
a9ba944e27
6 changed files with 114 additions and 121 deletions
|
@ -203,8 +203,7 @@ RsGRouterRoutingInfoItem *RsGRouterSerialiser::deserialise_RsGRouterRoutingInfoI
|
||||||
ok &= getRawUInt32(data, pktsize, &offset, &item->data_status);
|
ok &= getRawUInt32(data, pktsize, &offset, &item->data_status);
|
||||||
ok &= getRawUInt32(data, pktsize, &offset, &item->tunnel_status);
|
ok &= getRawUInt32(data, pktsize, &offset, &item->tunnel_status);
|
||||||
ok &= getRawTimeT(data, pktsize, &offset, item->received_time_TS);
|
ok &= getRawTimeT(data, pktsize, &offset, item->received_time_TS);
|
||||||
ok &= getRawTimeT(data, pktsize, &offset, item->last_tunnel_sent_TS);
|
ok &= getRawTimeT(data, pktsize, &offset, item->last_sent_TS);
|
||||||
ok &= getRawTimeT(data, pktsize, &offset, item->last_friend_sent_TS);
|
|
||||||
|
|
||||||
ok &= getRawTimeT(data, pktsize, &offset, item->last_tunnel_request_TS);
|
ok &= getRawTimeT(data, pktsize, &offset, item->last_tunnel_request_TS);
|
||||||
ok &= getRawUInt32(data, pktsize, &offset, &item->sending_attempts);
|
ok &= getRawUInt32(data, pktsize, &offset, &item->sending_attempts);
|
||||||
|
@ -568,8 +567,7 @@ uint32_t RsGRouterRoutingInfoItem::serial_size() const
|
||||||
s += 4 ; // data status_flags
|
s += 4 ; // data status_flags
|
||||||
s += 4 ; // tunnel status_flags
|
s += 4 ; // tunnel status_flags
|
||||||
s += 8 ; // received_time
|
s += 8 ; // received_time
|
||||||
s += 8 ; // last_tunnel_sent_TS
|
s += 8 ; // last_sent_TS
|
||||||
s += 8 ; // last_friend_sent_TS
|
|
||||||
|
|
||||||
s += 8 ; // last_TR_TS
|
s += 8 ; // last_TR_TS
|
||||||
s += 4 ; // sending attempts
|
s += 4 ; // sending attempts
|
||||||
|
@ -669,8 +667,7 @@ bool RsGRouterRoutingInfoItem::serialise(void *data,uint32_t& size) const
|
||||||
ok &= setRawUInt32(data, tlvsize, &offset, data_status) ;
|
ok &= setRawUInt32(data, tlvsize, &offset, data_status) ;
|
||||||
ok &= setRawUInt32(data, tlvsize, &offset, tunnel_status) ;
|
ok &= setRawUInt32(data, tlvsize, &offset, tunnel_status) ;
|
||||||
ok &= setRawTimeT(data, tlvsize, &offset, received_time_TS) ;
|
ok &= setRawTimeT(data, tlvsize, &offset, received_time_TS) ;
|
||||||
ok &= setRawTimeT(data, tlvsize, &offset, last_tunnel_sent_TS) ;
|
ok &= setRawTimeT(data, tlvsize, &offset, last_sent_TS) ;
|
||||||
ok &= setRawTimeT(data, tlvsize, &offset, last_friend_sent_TS) ;
|
|
||||||
ok &= setRawTimeT(data, tlvsize, &offset, last_tunnel_request_TS) ;
|
ok &= setRawTimeT(data, tlvsize, &offset, last_tunnel_request_TS) ;
|
||||||
ok &= setRawUInt32(data, tlvsize, &offset, sending_attempts) ;
|
ok &= setRawUInt32(data, tlvsize, &offset, sending_attempts) ;
|
||||||
|
|
||||||
|
@ -737,8 +734,7 @@ std::ostream& RsGRouterRoutingInfoItem::print(std::ostream& o, uint16_t)
|
||||||
o << " data status: "<< std::hex<< data_status << std::dec << std::endl ;
|
o << " data status: "<< std::hex<< data_status << std::dec << std::endl ;
|
||||||
o << " tunnel status: "<< tunnel_status << std::endl ;
|
o << " tunnel status: "<< tunnel_status << std::endl ;
|
||||||
o << " recv time: "<< received_time_TS << std::endl ;
|
o << " recv time: "<< received_time_TS << std::endl ;
|
||||||
o << " Last tunnel sent: "<< last_tunnel_sent_TS << std::endl ;
|
o << " Last sent: "<< last_sent_TS << std::endl ;
|
||||||
o << " Last friend sent: "<< last_friend_sent_TS << std::endl ;
|
|
||||||
o << " Sending attempts:"<< sending_attempts << std::endl ;
|
o << " Sending attempts:"<< sending_attempts << std::endl ;
|
||||||
o << " destination key: "<< data_item->destination_key << std::endl ;
|
o << " destination key: "<< data_item->destination_key << std::endl ;
|
||||||
o << " Client id: "<< client_id << std::endl ;
|
o << " Client id: "<< client_id << std::endl ;
|
||||||
|
|
|
@ -46,9 +46,7 @@ const uint8_t RS_PKT_SUBTYPE_GROUTER_TRANSACTION_ACKN = 0x11 ; // ac
|
||||||
|
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES = 0x80 ; // item to save matrix clues
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_MATRIX_CLUES = 0x80 ; // item to save matrix clues
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST = 0x82 ; // item to save friend lists
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_FRIENDS_LIST = 0x82 ; // item to save friend lists
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO_deprecated = 0x87 ; // deprecated. Don't use.
|
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO = 0x93 ; //
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO_deprecated2 = 0x88 ; // item to save routing info
|
|
||||||
const uint8_t RS_PKT_SUBTYPE_GROUTER_ROUTING_INFO = 0x92 ; //
|
|
||||||
|
|
||||||
const uint8_t QOS_PRIORITY_RS_GROUTER = 4 ; // relevant for items that travel through friends
|
const uint8_t QOS_PRIORITY_RS_GROUTER = 4 ; // relevant for items that travel through friends
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,9 @@ bool GRouterMatrix::updateRoutingProbabilities()
|
||||||
|
|
||||||
for(std::list<RoutingMatrixHitEntry>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
|
for(std::list<RoutingMatrixHitEntry>::const_iterator it2(it->second.begin());it2!=it->second.end();++it2)
|
||||||
{
|
{
|
||||||
float time_difference_in_days = 1 + (now - (*it2).time_stamp ) / 86400.0f ;
|
// Half life period is 7 days.
|
||||||
|
|
||||||
|
float time_difference_in_days = 1 + (now - (*it2).time_stamp ) / (7*86400.0f) ;
|
||||||
v[(*it2).friend_id] += (*it2).weight / (time_difference_in_days*time_difference_in_days) ;
|
v[(*it2).friend_id] += (*it2).weight / (time_difference_in_days*time_difference_in_days) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,10 +46,9 @@ static const float RS_GROUTER_BASE_WEIGHT_GXS_PACKET = 0.1f ; // base c
|
||||||
|
|
||||||
static const uint32_t MAX_TUNNEL_WAIT_TIME = 60 ; // wait for 60 seconds at most for a tunnel response.
|
static const uint32_t MAX_TUNNEL_WAIT_TIME = 60 ; // wait for 60 seconds at most for a tunnel response.
|
||||||
static const uint32_t MAX_TUNNEL_UNMANAGED_TIME = 600 ; // min time before retry tunnels for that msg.
|
static const uint32_t MAX_TUNNEL_UNMANAGED_TIME = 600 ; // min time before retry tunnels for that msg.
|
||||||
static const uint32_t MAX_DELAY_BETWEEN_TWO_SEND = 120 ; // wait for 120 seconds before re-sending.
|
static const uint32_t MAX_DELAY_FOR_RESEND = 2*86400+300 ; // re-send if held for more than 2 days (cache store period) plus security delay.
|
||||||
static const uint32_t TUNNEL_OK_WAIT_TIME = 2 ; // wait for 2 seconds after last tunnel ok, so that we have a complete set of tunnels.
|
static const uint32_t TUNNEL_OK_WAIT_TIME = 2 ; // wait for 2 seconds after last tunnel ok, so that we have a complete set of tunnels.
|
||||||
static const uint32_t MAX_GROUTER_DATA_SIZE = 2*1024*1024 ; // 2MB size limit. This is of course arbitrary.
|
static const uint32_t MAX_GROUTER_DATA_SIZE = 2*1024*1024 ; // 2MB size limit. This is of course arbitrary.
|
||||||
static const uint32_t MAX_RECEIPT_WAIT_TIME = 20 ; // wait for at most 20 secs for a receipt. If not, cancel.
|
|
||||||
static const uint32_t MAX_TRANSACTION_ACK_WAITING_TIME = 60 ; // wait for at most 60 secs for a ACK. If not restart the transaction.
|
static const uint32_t MAX_TRANSACTION_ACK_WAITING_TIME = 60 ; // wait for at most 60 secs for a ACK. If not restart the transaction.
|
||||||
static const uint32_t DIRECT_FRIEND_TRY_DELAY = 20 ; // wait for 20 secs if no friends available, then try tunnels.
|
static const uint32_t DIRECT_FRIEND_TRY_DELAY = 20 ; // wait for 20 secs if no friends available, then try tunnels.
|
||||||
static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // clean inactive data pipes for more than 5 mins
|
static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // clean inactive data pipes for more than 5 mins
|
||||||
|
@ -57,10 +56,7 @@ static const uint32_t MAX_INACTIVE_DATA_PIPE_DELAY = 300 ; // cl
|
||||||
static const time_t RS_GROUTER_DEBUG_OUTPUT_PERIOD = 10 ; // Output everything
|
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_AUTOWASH_PERIOD = 10 ; // Autowash every minute. Not a costly operation.
|
||||||
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 1 *10 ; // Check for key advertising every 10 minutes
|
static const time_t RS_GROUTER_MATRIX_UPDATE_PERIOD = 1 *10 ; // Check for key advertising every 10 minutes
|
||||||
static const time_t RS_GROUTER_ROUTING_WAITING_TIME = 2 *60 ; // time between two trial of sending a given message
|
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 2*86400 ; // Cached items are kept for 48 hours at most.
|
||||||
//atic const time_t RS_GROUTER_ROUTING_WAITING_TIME = 3600 ; // time between two trial of sending a given message
|
|
||||||
static const time_t RS_GROUTER_MEAN_EXPECTED_RTT = 30 ; // reference RTT time for a message.
|
|
||||||
static const uint32_t GROUTER_ITEM_MAX_CACHE_KEEP_TIME = 86400 ; // Cached items are kept for 24 hours at most.
|
|
||||||
|
|
||||||
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
static const uint32_t RS_GROUTER_DATA_STATUS_UNKNOWN = 0x0000 ; // unknown. Unused.
|
||||||
static const uint32_t RS_GROUTER_DATA_STATUS_PENDING = 0x0001 ; // item is pending. Should be sent asap.
|
static const uint32_t RS_GROUTER_DATA_STATUS_PENDING = 0x0001 ; // item is pending. Should be sent asap.
|
||||||
|
@ -75,7 +71,6 @@ static const uint32_t RS_GROUTER_SENDING_STATUS_FRIEND = 0x0002 ; // item wa
|
||||||
static const uint32_t RS_GROUTER_TUNNEL_STATUS_UNMANAGED = 0x0000 ; // no tunnel requested atm
|
static const uint32_t RS_GROUTER_TUNNEL_STATUS_UNMANAGED = 0x0000 ; // no tunnel requested atm
|
||||||
static const uint32_t RS_GROUTER_TUNNEL_STATUS_PENDING = 0x0001 ; // tunnel requested to turtle
|
static const uint32_t RS_GROUTER_TUNNEL_STATUS_PENDING = 0x0001 ; // tunnel requested to turtle
|
||||||
static const uint32_t RS_GROUTER_TUNNEL_STATUS_READY = 0x0002 ; // tunnel is ready but we're still waiting for various confirmations
|
static const uint32_t RS_GROUTER_TUNNEL_STATUS_READY = 0x0002 ; // tunnel is ready but we're still waiting for various confirmations
|
||||||
//static const uint32_t RS_GROUTER_TUNNEL_STATUS_CAN_SEND = 0x0003 ; // tunnel is ready and data can be sent
|
|
||||||
|
|
||||||
class FriendTrialRecord
|
class FriendTrialRecord
|
||||||
{
|
{
|
||||||
|
@ -105,8 +100,7 @@ public:
|
||||||
uint32_t tunnel_status ; // status of tunnel handling.
|
uint32_t tunnel_status ; // status of tunnel handling.
|
||||||
|
|
||||||
time_t received_time_TS ; // time at which the item was originally received
|
time_t received_time_TS ; // time at which the item was originally received
|
||||||
time_t last_tunnel_sent_TS ; // last time the item was sent to friends
|
time_t last_sent_TS ; // last time the item was sent
|
||||||
time_t last_friend_sent_TS ; // last time the item was sent to friends
|
|
||||||
time_t last_tunnel_request_TS ; // last time tunnels have been asked for this item.
|
time_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
|
uint32_t sending_attempts ; // number of times tunnels have been asked for this peer without success
|
||||||
|
|
||||||
|
|
|
@ -515,11 +515,7 @@ void p3GRouter::handleLowLevelTransactionAckItem(RsGRouterTransactionAcknItem *t
|
||||||
if(it != _pending_messages.end())
|
if(it != _pending_messages.end())
|
||||||
{
|
{
|
||||||
it->second.data_status = RS_GROUTER_DATA_STATUS_SENT;
|
it->second.data_status = RS_GROUTER_DATA_STATUS_SENT;
|
||||||
|
it->second.last_sent_TS = time(NULL) ;
|
||||||
if(mTurtle->isTurtlePeer(trans_ack_item->PeerId()))
|
|
||||||
it->second.last_tunnel_sent_TS = time(NULL) ;
|
|
||||||
else
|
|
||||||
it->second.last_friend_sent_TS = time(NULL) ;
|
|
||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
std::cerr << " setting new status as sent/awaiting receipt." << std::endl;
|
std::cerr << " setting new status as sent/awaiting receipt." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -809,7 +805,6 @@ if(!_pending_messages.empty())
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint32_t send_retry_time_delays[6] = { 0, 1800, 3600, 5*3600, 12*3600, 24*2600 } ;
|
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
std::vector<std::pair<int,GRouterRoutingInfo*> > priority_list ;
|
std::vector<std::pair<int,GRouterRoutingInfo*> > priority_list ;
|
||||||
|
|
||||||
|
@ -820,8 +815,7 @@ if(!_pending_messages.empty())
|
||||||
<< ", data_status=" << it->second.data_status << ", tunnel_status=" << it->second.tunnel_status
|
<< ", data_status=" << it->second.data_status << ", tunnel_status=" << it->second.tunnel_status
|
||||||
<< ", last received: "<< now - it->second.received_time_TS << " (secs ago)"
|
<< ", last received: "<< now - it->second.received_time_TS << " (secs ago)"
|
||||||
<< ", last TR: "<< now - it->second.last_tunnel_request_TS << " (secs ago)"
|
<< ", last TR: "<< now - it->second.last_tunnel_request_TS << " (secs ago)"
|
||||||
<< ", last tunnel sent: " << now - it->second.last_tunnel_sent_TS << " (secs ago) "
|
<< ", last sent: " << now - it->second.last_sent_TS << " (secs ago) "<< std::endl;
|
||||||
<< ", last friend sent: " << now - it->second.last_friend_sent_TS << " (secs ago) " ;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(it->second.data_status == RS_GROUTER_DATA_STATUS_PENDING && (it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS))
|
if(it->second.data_status == RS_GROUTER_DATA_STATUS_PENDING && (it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS))
|
||||||
|
@ -829,7 +823,7 @@ if(!_pending_messages.empty())
|
||||||
if(it->second.tunnel_status == RS_GROUTER_TUNNEL_STATUS_UNMANAGED && it->second.last_tunnel_request_TS + MAX_TUNNEL_UNMANAGED_TIME < now)
|
if(it->second.tunnel_status == RS_GROUTER_TUNNEL_STATUS_UNMANAGED && it->second.last_tunnel_request_TS + MAX_TUNNEL_UNMANAGED_TIME < now)
|
||||||
{
|
{
|
||||||
uint32_t item_delay = now - it->second.last_tunnel_request_TS ;
|
uint32_t item_delay = now - it->second.last_tunnel_request_TS ;
|
||||||
int item_priority = item_delay - send_retry_time_delays[std::min(5u,it->second.sending_attempts)] ;
|
int item_priority = item_delay ;
|
||||||
|
|
||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
grouter_debug() << " delay=" << item_delay << " attempts=" << it->second.sending_attempts << ", priority=" << item_priority << std::endl;
|
grouter_debug() << " delay=" << item_delay << " attempts=" << it->second.sending_attempts << ", priority=" << item_priority << std::endl;
|
||||||
|
@ -857,31 +851,15 @@ if(!_pending_messages.empty())
|
||||||
grouter_debug() << std::endl;
|
grouter_debug() << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_RECEIPT_OK )
|
|
||||||
{
|
|
||||||
#ifdef GROUTER_DEBUG
|
|
||||||
std::cerr << " closing pending tunnels." << std::endl;
|
|
||||||
#endif
|
|
||||||
mTurtle->stopMonitoringTunnels(it->second.tunnel_hash) ;
|
|
||||||
|
|
||||||
it->second.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
|
||||||
}
|
|
||||||
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_SENT)// && it->second.last_tunnel_sent_TS + MAX_RECEIPT_WAIT_TIME < now)
|
|
||||||
{
|
|
||||||
#ifdef GROUTER_DEBUG
|
|
||||||
std::cerr << " closing pending tunnels." << std::endl;
|
|
||||||
#endif
|
|
||||||
mTurtle->stopMonitoringTunnels(it->second.tunnel_hash) ;
|
|
||||||
|
|
||||||
it->second.routing_flags &= ~GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS ;
|
|
||||||
it->second.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
|
||||||
|
|
||||||
//it->second.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
|
||||||
}
|
|
||||||
#ifdef GROUTER_DEBUG
|
|
||||||
else
|
else
|
||||||
std::cerr << " doing nothing." << std::endl;
|
{
|
||||||
|
#ifdef GROUTER_DEBUG
|
||||||
|
std::cerr << " closing pending tunnels." << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
mTurtle->stopMonitoringTunnels(it->second.tunnel_hash) ;
|
||||||
|
|
||||||
|
it->second.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
||||||
|
}
|
||||||
|
|
||||||
// also check that all tunnels are actually active, to remove any old dead tunnels
|
// also check that all tunnels are actually active, to remove any old dead tunnels
|
||||||
//
|
//
|
||||||
|
@ -916,6 +894,7 @@ if(!_pending_messages.empty())
|
||||||
|
|
||||||
priority_list[i].second->tunnel_status = RS_GROUTER_TUNNEL_STATUS_PENDING ;
|
priority_list[i].second->tunnel_status = RS_GROUTER_TUNNEL_STATUS_PENDING ;
|
||||||
priority_list[i].second->last_tunnel_request_TS = now ;
|
priority_list[i].second->last_tunnel_request_TS = now ;
|
||||||
|
priority_list[i].second->sending_attempts++ ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,7 +925,6 @@ void p3GRouter::routePendingObjects()
|
||||||
#endif
|
#endif
|
||||||
if(it->second.data_status == RS_GROUTER_DATA_STATUS_PENDING)
|
if(it->second.data_status == RS_GROUTER_DATA_STATUS_PENDING)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Look for tunnels and friends where to send the data. Send to both.
|
// Look for tunnels and friends where to send the data. Send to both.
|
||||||
|
|
||||||
std::list<RsPeerId> peers ;
|
std::list<RsPeerId> peers ;
|
||||||
|
@ -965,8 +943,7 @@ void p3GRouter::routePendingObjects()
|
||||||
std::cerr << " no direct friends available" << std::endl;
|
std::cerr << " no direct friends available" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(it->second.received_time_TS + DIRECT_FRIEND_TRY_DELAY < now &&
|
if(it->second.received_time_TS + DIRECT_FRIEND_TRY_DELAY < now && !(it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS))
|
||||||
!(it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS))
|
|
||||||
{
|
{
|
||||||
#ifdef GROUTER_DEBUG
|
#ifdef GROUTER_DEBUG
|
||||||
std::cerr << " enabling tunnels for this message." << std::endl;
|
std::cerr << " enabling tunnels for this message." << std::endl;
|
||||||
|
@ -997,7 +974,7 @@ void p3GRouter::routePendingObjects()
|
||||||
// change item state in waiting list
|
// change item state in waiting list
|
||||||
|
|
||||||
it->second.data_status = RS_GROUTER_DATA_STATUS_ONGOING ;
|
it->second.data_status = RS_GROUTER_DATA_STATUS_ONGOING ;
|
||||||
it->second.data_transaction_TS = now ; ;
|
it->second.data_transaction_TS = now ;
|
||||||
}
|
}
|
||||||
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_ONGOING && now > MAX_TRANSACTION_ACK_WAITING_TIME + it->second.data_transaction_TS)
|
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_ONGOING && now > MAX_TRANSACTION_ACK_WAITING_TIME + it->second.data_transaction_TS)
|
||||||
{
|
{
|
||||||
|
@ -1006,6 +983,23 @@ void p3GRouter::routePendingObjects()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
it->second.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
it->second.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
||||||
|
}
|
||||||
|
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_SENT)
|
||||||
|
{
|
||||||
|
if( (it->second.routing_flags & GRouterRoutingInfo::ROUTING_FLAGS_IS_ORIGIN) && it->second.last_sent_TS + MAX_DELAY_FOR_RESEND < now)
|
||||||
|
{
|
||||||
|
#ifdef GROUTER_DEBUG
|
||||||
|
std::cerr << " item was not received. Re-setting status to PENDING" << std::endl;
|
||||||
|
#endif
|
||||||
|
it->second.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#ifdef GROUTER_DEBUG
|
||||||
|
std::cerr << " item was sent. Desactivating tunnels." << std::endl;
|
||||||
|
#endif
|
||||||
|
it->second.routing_flags &= ~GRouterRoutingInfo::ROUTING_FLAGS_ALLOW_TUNNELS ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_RECEIPT_OK)
|
else if(it->second.data_status == RS_GROUTER_DATA_STATUS_RECEIPT_OK)
|
||||||
{
|
{
|
||||||
|
@ -1470,6 +1464,16 @@ void p3GRouter::handleIncomingReceiptItem(RsGRouterSignedReceiptItem *receipt_it
|
||||||
client_service->notifyDataStatus(mid, GROUTER_CLIENT_SERVICE_DATA_STATUS_RECEIVED) ;
|
client_service->notifyDataStatus(mid, GROUTER_CLIENT_SERVICE_DATA_STATUS_RECEIVED) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// also note the incoming route in the routing matrix
|
||||||
|
|
||||||
|
if(!mTurtle->isTurtlePeer(receipt_item->PeerId()))
|
||||||
|
{
|
||||||
|
#ifdef GROUTER_DEBUG
|
||||||
|
std::cerr << " receipt item comes from a direct friend. Marking route in routing matrix." << std::endl;
|
||||||
|
#endif
|
||||||
|
addRoutingClue(receipt_item->signature.keyId,receipt_item->PeerId()) ;
|
||||||
|
}
|
||||||
|
|
||||||
if(changed)
|
if(changed)
|
||||||
IndicateConfigChanged() ;
|
IndicateConfigChanged() ;
|
||||||
}
|
}
|
||||||
|
@ -1603,8 +1607,7 @@ void p3GRouter::handleIncomingDataItem(RsGRouterGenericDataItem *data_item)
|
||||||
info.data_item = data_item->duplicate() ;
|
info.data_item = data_item->duplicate() ;
|
||||||
info.receipt_item = receipt_item ; // inited before, or NULL.
|
info.receipt_item = receipt_item ; // inited before, or NULL.
|
||||||
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
||||||
info.last_tunnel_sent_TS = 0 ;
|
info.last_sent_TS = 0 ;
|
||||||
info.last_friend_sent_TS = 0 ;
|
|
||||||
info.item_hash = item_hash ;
|
info.item_hash = item_hash ;
|
||||||
info.last_tunnel_request_TS = 0 ;
|
info.last_tunnel_request_TS = 0 ;
|
||||||
info.sending_attempts = 0 ;
|
info.sending_attempts = 0 ;
|
||||||
|
@ -1925,8 +1928,7 @@ bool p3GRouter::sendData(const RsGxsId& destination,const GRouterServiceId& clie
|
||||||
info.receipt_item = NULL ;
|
info.receipt_item = NULL ;
|
||||||
info.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
info.data_status = RS_GROUTER_DATA_STATUS_PENDING ;
|
||||||
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
info.tunnel_status = RS_GROUTER_TUNNEL_STATUS_UNMANAGED ;
|
||||||
info.last_tunnel_sent_TS = 0 ;
|
info.last_sent_TS = 0 ;
|
||||||
info.last_friend_sent_TS = 0 ;
|
|
||||||
info.last_tunnel_request_TS = 0 ;
|
info.last_tunnel_request_TS = 0 ;
|
||||||
info.item_hash = computeDataItemHash(data_item) ;
|
info.item_hash = computeDataItemHash(data_item) ;
|
||||||
info.sending_attempts = 0 ;
|
info.sending_attempts = 0 ;
|
||||||
|
@ -2111,7 +2113,7 @@ bool p3GRouter::getRoutingCacheInfo(std::vector<GRouterRoutingCacheInfo>& infos)
|
||||||
cinfo.destination = it->second.data_item->destination_key ;
|
cinfo.destination = it->second.data_item->destination_key ;
|
||||||
cinfo.routing_time = it->second.received_time_TS ;
|
cinfo.routing_time = it->second.received_time_TS ;
|
||||||
cinfo.last_tunnel_attempt_time = it->second.last_tunnel_request_TS ;
|
cinfo.last_tunnel_attempt_time = it->second.last_tunnel_request_TS ;
|
||||||
cinfo.last_sent_time = std::max(it->second.last_tunnel_sent_TS,it->second.last_friend_sent_TS) ;
|
cinfo.last_sent_time = it->second.last_sent_TS ;
|
||||||
cinfo.receipt_available = (it->second.receipt_item != NULL);
|
cinfo.receipt_available = (it->second.receipt_item != NULL);
|
||||||
cinfo.data_status = it->second.data_status ;
|
cinfo.data_status = it->second.data_status ;
|
||||||
cinfo.tunnel_status = it->second.tunnel_status ;
|
cinfo.tunnel_status = it->second.tunnel_status ;
|
||||||
|
@ -2156,8 +2158,7 @@ void p3GRouter::debugDump()
|
||||||
grouter_debug() << " data hash : " << it->second.item_hash ;
|
grouter_debug() << " data hash : " << it->second.item_hash ;
|
||||||
grouter_debug() << " Destination : " << it->second.data_item->destination_key ;
|
grouter_debug() << " Destination : " << it->second.data_item->destination_key ;
|
||||||
grouter_debug() << " Received : " << now - it->second.received_time_TS << " secs ago.";
|
grouter_debug() << " Received : " << now - it->second.received_time_TS << " secs ago.";
|
||||||
grouter_debug() << " Last tunnel sent: " << now - it->second.last_tunnel_sent_TS << " secs ago.";
|
grouter_debug() << " Last sent : " << now - it->second.last_sent_TS << " secs ago.";
|
||||||
grouter_debug() << " Last friend sent: " << now - it->second.last_friend_sent_TS << " secs ago.";
|
|
||||||
grouter_debug() << " Transaction TS : " << now - it->second.data_transaction_TS << " secs ago.";
|
grouter_debug() << " Transaction TS : " << now - it->second.data_transaction_TS << " secs ago.";
|
||||||
grouter_debug() << " Data Status : " << statusString[it->second.data_status] << std::endl;
|
grouter_debug() << " Data Status : " << statusString[it->second.data_status] << std::endl;
|
||||||
grouter_debug() << " Tunl Status : " << statusString[it->second.tunnel_status] << std::endl;
|
grouter_debug() << " Tunl Status : " << statusString[it->second.tunnel_status] << std::endl;
|
||||||
|
|
|
@ -402,9 +402,11 @@ HEADERS += grouter/groutercache.h \
|
||||||
grouter/grouteritems.h \
|
grouter/grouteritems.h \
|
||||||
grouter/p3grouter.h \
|
grouter/p3grouter.h \
|
||||||
grouter/rsgroutermatrix.h \
|
grouter/rsgroutermatrix.h \
|
||||||
|
grouter/groutertypes.h \
|
||||||
grouter/rsgrouterclient.h
|
grouter/rsgrouterclient.h
|
||||||
|
|
||||||
HEADERS += serialiser/rsbaseserial.h \
|
HEADERS += serialiser/itempriorities.h \
|
||||||
|
serialiser/rsbaseserial.h \
|
||||||
serialiser/rsfiletransferitems.h \
|
serialiser/rsfiletransferitems.h \
|
||||||
serialiser/rsserviceserialiser.h \
|
serialiser/rsserviceserialiser.h \
|
||||||
serialiser/rsconfigitems.h \
|
serialiser/rsconfigitems.h \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue