fixed a few bugs in display of tracking info

This commit is contained in:
csoler 2015-10-27 22:41:29 -04:00
parent 2096cd6c52
commit 79c80c968a
8 changed files with 53 additions and 26 deletions

View file

@ -27,7 +27,7 @@
#include "groutermatrix.h"
#include "grouteritems.h"
//#define ROUTING_MATRIX_DEBUG
#define ROUTING_MATRIX_DEBUG
GRouterMatrix::GRouterMatrix()
{
@ -197,6 +197,10 @@ void GRouterMatrix::debugDump() const
std::cerr << it->second[i] << " " ;
std::cerr << std::endl;
}
std::cerr << " Tracking clues: " << std::endl;
for(std::map<RsGxsMessageId, RoutingTrackEntry>::const_iterator it(_tracking_clues.begin());it!=_tracking_clues.end();++it)
std::cerr << " " << it->first << ": from " << it->second.friend_id << " " << now - it->second.time_stamp << " secs ago." << std::endl;
}
bool GRouterMatrix::computeRoutingProbabilities(const GRouterKeyId& key_id, const std::vector<RsPeerId>& friends, std::vector<float>& probas) const

View file

@ -39,7 +39,7 @@ static const uint16_t GROUTER_CLIENT_ID_MESSAGES = 0x1001 ;
static const uint32_t RS_GROUTER_MATRIX_MAX_HIT_ENTRIES = 10 ; // max number of clues to store
static const uint32_t RS_GROUTER_MATRIX_MIN_TIME_BETWEEN_HITS = 60 ; // can be set to up to half the publish time interval. Prevents flooding routes.
static const uint32_t RS_GROUTER_MIN_CONFIG_SAVE_PERIOD = 5 ; // at most save config every 5 seconds
static const uint32_t RS_GROUTER_MIN_CONFIG_SAVE_PERIOD = 10 ; // at most save config every 10 seconds
static const uint32_t RS_GROUTER_MAX_KEEP_TRACKING_CLUES = 86400*10 ; // max time for which we keep record of tracking info: 10 days.
static const float RS_GROUTER_BASE_WEIGHT_ROUTED_MSG = 1.0f ; // base contribution of routed message clue to routing matrix

View file

@ -1703,9 +1703,10 @@ void p3GRouter::addTrackingInfo(const RsGxsMessageId& mid,const RsPeerId& peer_i
{
RS_STACK_MUTEX(grMtx) ;
#ifdef GROUTER_DEBUG
grouter_debug() << "Received new routing clue for key " << id << " from peer " << peer_id << std::endl;
grouter_debug() << "Received new routing clue for key " << mid << " from peer " << peer_id << std::endl;
#endif
_routing_matrix.addTrackingInfo(mid,peer_id) ;
_changed = true ;
}
void p3GRouter::addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id)
{
@ -1714,6 +1715,7 @@ void p3GRouter::addRoutingClue(const GRouterKeyId& id,const RsPeerId& peer_id)
grouter_debug() << "Received new routing clue for key " << id << " from peer " << peer_id << std::endl;
#endif
_routing_matrix.addRoutingClue(id,peer_id,RS_GROUTER_BASE_WEIGHT_GXS_PACKET) ;
_changed = true ;
}
bool p3GRouter::registerClientService(const GRouterServiceId& id,GRouterClientService *service)
@ -2230,8 +2232,8 @@ void p3GRouter::debugDump()
grouter_debug() << " Routing matrix: " << std::endl;
// if(_debug_enabled)
// _routing_matrix.debugDump() ;
if(_debug_enabled)
_routing_matrix.debugDump() ;
}