mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 21:04:32 -04:00
added data hash to GxsTrans display
This commit is contained in:
parent
4fa6cbe6e6
commit
a3096f26a5
4 changed files with 29 additions and 34 deletions
|
@ -16,6 +16,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "util/rsdir.h"
|
||||||
#include "gxstrans/p3gxstrans.h"
|
#include "gxstrans/p3gxstrans.h"
|
||||||
#include "util/stacktrace.h"
|
#include "util/stacktrace.h"
|
||||||
|
|
||||||
|
@ -47,8 +48,12 @@ bool p3GxsTrans::getStatistics(GxsTransStatistics& stats)
|
||||||
|
|
||||||
RsGxsTransOutgoingRecord rec ;
|
RsGxsTransOutgoingRecord rec ;
|
||||||
rec.status = pr.status ;
|
rec.status = pr.status ;
|
||||||
|
rec.send_TS = pr.mailItem.meta.mPublishTs ;
|
||||||
|
rec.group_id = pr.mailItem.meta.mGroupId ;
|
||||||
|
rec.trans_id = pr.mailItem.mailId ;
|
||||||
rec.recipient = pr.recipient ;
|
rec.recipient = pr.recipient ;
|
||||||
rec.data_size = pr.mailData.size();
|
rec.data_size = pr.mailData.size();
|
||||||
|
rec.data_hash = RsDirUtil::sha1sum(pr.mailData.data(),pr.mailData.size());
|
||||||
rec.client_service = pr.clientService ;
|
rec.client_service = pr.clientService ;
|
||||||
|
|
||||||
stats.outgoing_records.push_back(rec) ;
|
stats.outgoing_records.push_back(rec) ;
|
||||||
|
|
|
@ -69,8 +69,13 @@ struct RsGxsTransOutgoingRecord
|
||||||
GxsTransSendStatus status;
|
GxsTransSendStatus status;
|
||||||
RsGxsId recipient;
|
RsGxsId recipient;
|
||||||
RsGxsTransId trans_id;
|
RsGxsTransId trans_id;
|
||||||
uint32_t data_size ;
|
|
||||||
GxsTransSubServices client_service;
|
GxsTransSubServices client_service;
|
||||||
|
|
||||||
|
uint32_t data_size ;
|
||||||
|
Sha1CheckSum data_hash ;
|
||||||
|
uint32_t send_TS ;
|
||||||
|
RsGxsGroupId group_id ;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsTrans: public RsGxsIfaceHelper
|
class RsGxsTrans: public RsGxsIfaceHelper
|
||||||
|
|
|
@ -46,15 +46,13 @@
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
||||||
#define COL_ID 0
|
#define COL_ID 0
|
||||||
#define COL_NICKNAME 1
|
#define COL_DESTINATION 1
|
||||||
#define COL_DESTINATION 2
|
#define COL_NICKNAME 2
|
||||||
#define COL_DATASTATUS 3
|
#define COL_DATASTATUS 3
|
||||||
#define COL_TUNNELSTATUS 4
|
#define COL_DATASIZE 4
|
||||||
#define COL_DATASIZE 5
|
#define COL_DATAHASH 5
|
||||||
#define COL_DATAHASH 6
|
#define COL_SEND 6
|
||||||
#define COL_RECEIVED 7
|
#define COL_GROUP_ID 7
|
||||||
#define COL_SEND 8
|
|
||||||
#define COL_DUPLICATION_FACTOR 9
|
|
||||||
|
|
||||||
static const int PARTIAL_VIEW_SIZE = 9 ;
|
static const int PARTIAL_VIEW_SIZE = 9 ;
|
||||||
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
|
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
|
||||||
|
@ -201,9 +199,6 @@ void GxsTransportStatistics::updateContent()
|
||||||
rsGxsTrans->getStatistics(transinfo) ;
|
rsGxsTrans->getStatistics(transinfo) ;
|
||||||
|
|
||||||
treeWidget->clear();
|
treeWidget->clear();
|
||||||
|
|
||||||
static const QString data_status_string[6] = { "Unkown","Pending","Sent","Receipt OK","Ongoing","Done" } ;
|
|
||||||
|
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
|
|
||||||
groupBox->setTitle(tr("Pending packets")+": " + QString::number(transinfo.outgoing_records.size()) );
|
groupBox->setTitle(tr("Pending packets")+": " + QString::number(transinfo.outgoing_records.size()) );
|
||||||
|
@ -222,14 +217,14 @@ void GxsTransportStatistics::updateContent()
|
||||||
if(nickname.isEmpty())
|
if(nickname.isEmpty())
|
||||||
nickname = tr("Unknown");
|
nickname = tr("Unknown");
|
||||||
|
|
||||||
item -> setData(COL_ID, Qt::DisplayRole, QString::number(rec.trans_id,8).rightJustified(8,'0'));
|
item -> setData(COL_ID, Qt::DisplayRole, QString::number(rec.trans_id,16).rightJustified(8,'0'));
|
||||||
item -> setData(COL_NICKNAME, Qt::DisplayRole, nickname ) ;
|
item -> setData(COL_NICKNAME, Qt::DisplayRole, nickname ) ;
|
||||||
item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(rec.recipient.toStdString()));
|
item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(rec.recipient.toStdString()));
|
||||||
item -> setData(COL_DATASTATUS, Qt::DisplayRole, data_status_string[int(rec.status) % 6]);
|
item -> setData(COL_DATASTATUS, Qt::DisplayRole, getStatusString(rec.status));
|
||||||
item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(rec.data_size));
|
item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(rec.data_size));
|
||||||
// item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
|
item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(rec.data_hash.toStdString()));
|
||||||
// item -> setData(COL_RECEIVED, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
|
item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - rec.send_TS));
|
||||||
// item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
|
item -> setData(COL_GROUP_ID, Qt::DisplayRole, QString::fromStdString(rec.group_id.toStdString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +344,7 @@ void GxsTransportStatisticsWidget::resizeEvent(QResizeEvent *event)
|
||||||
|
|
||||||
void GxsTransportStatistics::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
void GxsTransportStatistics::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "CirclesDialog::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "GxsTransportStatistics::loadRequest() UserType: " << req.mUserType;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
if (queue != mTransQueue)
|
if (queue != mTransQueue)
|
||||||
|
@ -364,7 +359,7 @@ void GxsTransportStatistics::loadRequest(const TokenQueue *queue, const TokenReq
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
std::cerr << "CirclesDialog::loadRequest() ERROR: INVALID TYPE";
|
std::cerr << "GxsTransportStatistics::loadRequest() ERROR: INVALID TYPE";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +395,7 @@ void GxsTransportStatistics::loadGroupMeta(const uint32_t& token)
|
||||||
|
|
||||||
if (!rsGxsTrans->getGroupSummary(token,groupInfo))
|
if (!rsGxsTrans->getGroupSummary(token,groupInfo))
|
||||||
{
|
{
|
||||||
std::cerr << "CirclesDialog::loadGroupMeta() Error getting GroupMeta";
|
std::cerr << "GxsTransportStatistics::loadGroupMeta() Error getting GroupMeta";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
mStateHelper->setActive(GXSTRANS_GROUP_META, false);
|
mStateHelper->setActive(GXSTRANS_GROUP_META, false);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -63,12 +63,12 @@
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Identity Name</string>
|
<string>Destination ID</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Destinaton</string>
|
<string>Destination Name</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
|
@ -78,12 +78,7 @@
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tunnel status</string>
|
<string>Data size</string>
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Stored data size</string>
|
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
|
@ -91,11 +86,6 @@
|
||||||
<string>Data hash</string>
|
<string>Data hash</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Receive time (secs ago)</string>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sending time (secs ago)</string>
|
<string>Sending time (secs ago)</string>
|
||||||
|
@ -103,7 +93,7 @@
|
||||||
</column>
|
</column>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Branching factor</string>
|
<string>Group ID</string>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
</column>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue