diff --git a/src/turtle/p3turtle.cc b/src/turtle/p3turtle.cc index ad0ebda67e..3e378ea505 100644 --- a/src/turtle/p3turtle.cc +++ b/src/turtle/p3turtle.cc @@ -1307,6 +1307,7 @@ void p3turtle::routeGenericTunnelItem(RsTurtleGenericTunnelItem *item) tunnel.time_stamp = time(NULL) ; tunnel.transfered_bytes += RsTurtleSerialiser().size(item); + tunnel.total_bytes += RsTurtleSerialiser().size(item); if(item->PeerId() == tunnel.local_dst) item->setTravelingDirection(RsTurtleGenericTunnelItem::DIRECTION_CLIENT) ; @@ -1488,6 +1489,7 @@ void p3turtle::sendTurtleData(const RsPeerId& virtual_peer_id,RsTurtleGenericTun tunnel.time_stamp = time(NULL) ; tunnel.transfered_bytes += ss ; + tunnel.total_bytes += ss ; if(tunnel.local_src == _own_id) { @@ -1689,6 +1691,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item) tt.local_dst = _own_id ; // this means us tt.time_stamp = time(NULL) ; tt.transfered_bytes = 0 ; + tt.total_bytes = 0 ; tt.speed_Bps = 0.0f ; _local_tunnels[t_id] = tt ; @@ -1893,6 +1896,7 @@ void p3turtle::handleTunnelResult(RsTurtleTunnelOkItem *item) tunnel.hash.clear() ; tunnel.time_stamp = time(NULL) ; tunnel.transfered_bytes = 0 ; + tunnel.total_bytes = 0 ; tunnel.speed_Bps = 0.0f ; #ifdef P3TURTLE_DEBUG @@ -2388,6 +2392,7 @@ void p3turtle::getInfo( std::vector >& hashes_info, tunnel.push_back(it->second.hash.toStdString()) ; tunnel.push_back(printNumber(now-it->second.time_stamp) + " secs ago") ; tunnel.push_back(printFloatNumber(it->second.speed_Bps,false)) ; // + tunnel.push_back(printNumber(it->second.total_bytes)) ; } search_reqs_info.clear(); diff --git a/src/turtle/p3turtle.h b/src/turtle/p3turtle.h index d6a359567b..72fcb4fde2 100644 --- a/src/turtle/p3turtle.h +++ b/src/turtle/p3turtle.h @@ -187,7 +187,8 @@ class TurtleTunnel TurtlePeerId local_src ; // where packets come from. Direction to the source. TurtlePeerId local_dst ; // where packets should go. Direction to the destination. uint32_t time_stamp ; // last time the tunnel was actually used. Used for cleaning old tunnels. - uint32_t transfered_bytes ; // total bytes transferred in this tunnel. + uint32_t transfered_bytes ; // this one used for estimation + uint64_t total_bytes ; // total bytes transferred in this tunnel. float speed_Bps ; // speed of the traffic through the tunnel /* For ending/starting tunnels only. */