mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
added display of ongoing record status for GxsTrans. Unfinished.
This commit is contained in:
parent
fbeb6ff98d
commit
a136fb6fda
5 changed files with 132 additions and 219 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
typedef unsigned int uint;
|
||||
|
||||
RsGxsTrans *rsGxsTrans = NULL ;
|
||||
|
||||
p3GxsTrans::~p3GxsTrans()
|
||||
{
|
||||
p3Config::saveConfiguration();
|
||||
|
@ -34,6 +36,26 @@ p3GxsTrans::~p3GxsTrans()
|
|||
bool p3GxsTrans::getStatistics(GxsTransStatistics& stats)
|
||||
{
|
||||
stats.prefered_group_id = mPreferredGroupId;
|
||||
stats.outgoing_records.clear();
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mOutgoingMutex);
|
||||
|
||||
for ( auto it = mOutgoingQueue.begin(); it != mOutgoingQueue.end(); ++it)
|
||||
{
|
||||
const OutgoingRecord& pr(it->second);
|
||||
|
||||
RsGxsTransOutgoingRecord rec ;
|
||||
rec.status = pr.status ;
|
||||
rec.recipient = pr.recipient ;
|
||||
rec.data_size = pr.mailData.size();
|
||||
rec.client_service = pr.clientService ;
|
||||
|
||||
stats.outgoing_records.push_back(rec) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsTrans::sendMail( RsGxsTransId& mailId,
|
||||
|
|
|
@ -23,30 +23,11 @@
|
|||
#include "serialiser/rsbaseserial.h"
|
||||
#include "serialiser/rstlvidset.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsgxstrans.h"
|
||||
#include "retroshare/rsgxscircles.h" // For: GXS_CIRCLE_TYPE_PUBLIC
|
||||
#include "services/p3idservice.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
|
||||
/// Subservices identifiers (like port for TCP)
|
||||
enum class GxsTransSubServices : uint16_t
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
TEST_SERVICE = 1,
|
||||
P3_MSG_SERVICE = 2,
|
||||
P3_CHAT_SERVICE = 3
|
||||
};
|
||||
|
||||
/// Values must fit into uint8_t
|
||||
enum class GxsTransItemsSubtypes : uint8_t
|
||||
{
|
||||
GXS_TRANS_SUBTYPE_MAIL = 1,
|
||||
GXS_TRANS_SUBTYPE_RECEIPT = 2,
|
||||
GXS_TRANS_SUBTYPE_GROUP = 3,
|
||||
OUTGOING_RECORD_ITEM = 4
|
||||
};
|
||||
|
||||
typedef uint64_t RsGxsTransId;
|
||||
|
||||
struct RsNxsTransPresignedReceipt : RsNxsMsg
|
||||
{
|
||||
RsNxsTransPresignedReceipt() : RsNxsMsg(RS_SERVICE_TYPE_GXS_TRANS) {}
|
||||
|
@ -188,27 +169,6 @@ struct RsGxsTransGroupItem : RsGxsGrpItem
|
|||
{ return out; }
|
||||
};
|
||||
|
||||
enum class GxsTransSendStatus : uint8_t
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
PENDING_PROCESSING,
|
||||
PENDING_PREFERRED_GROUP,
|
||||
PENDING_RECEIPT_CREATE,
|
||||
PENDING_RECEIPT_SIGNATURE,
|
||||
PENDING_SERIALIZATION,
|
||||
PENDING_PAYLOAD_CREATE,
|
||||
PENDING_PAYLOAD_ENCRYPT,
|
||||
PENDING_PUBLISH,
|
||||
/** This will be useful so the user can know if the mail reached at least
|
||||
* some friend node, in case of internet connection interruption */
|
||||
//PENDING_TRANSFER,
|
||||
PENDING_RECEIPT_RECEIVE,
|
||||
/// Records with status >= RECEIPT_RECEIVED get deleted
|
||||
RECEIPT_RECEIVED,
|
||||
FAILED_RECEIPT_SIGNATURE = 240,
|
||||
FAILED_ENCRYPTION
|
||||
};
|
||||
|
||||
class RsGxsTransSerializer;
|
||||
struct OutgoingRecord : RsItem
|
||||
{
|
||||
|
|
|
@ -1,7 +1,50 @@
|
|||
#pragma once
|
||||
|
||||
#include "retroshare/rstokenservice.h"
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "retroshare/rsgxscommon.h"
|
||||
|
||||
/// Subservices identifiers (like port for TCP)
|
||||
enum class GxsTransSubServices : uint16_t
|
||||
{
|
||||
UNKNOWN = 0x00,
|
||||
TEST_SERVICE = 0x01,
|
||||
P3_MSG_SERVICE = 0x02,
|
||||
P3_CHAT_SERVICE = 0x03
|
||||
};
|
||||
|
||||
/// Values must fit into uint8_t
|
||||
enum class GxsTransItemsSubtypes : uint8_t
|
||||
{
|
||||
GXS_TRANS_SUBTYPE_MAIL = 0x01,
|
||||
GXS_TRANS_SUBTYPE_RECEIPT = 0x02,
|
||||
GXS_TRANS_SUBTYPE_GROUP = 0x03,
|
||||
OUTGOING_RECORD_ITEM = 0x04
|
||||
};
|
||||
|
||||
enum class GxsTransSendStatus : uint8_t
|
||||
{
|
||||
UNKNOWN = 0x00,
|
||||
PENDING_PROCESSING = 0x01,
|
||||
PENDING_PREFERRED_GROUP = 0x02,
|
||||
PENDING_RECEIPT_CREATE = 0x03,
|
||||
PENDING_RECEIPT_SIGNATURE = 0x04,
|
||||
PENDING_SERIALIZATION = 0x05,
|
||||
PENDING_PAYLOAD_CREATE = 0x06,
|
||||
PENDING_PAYLOAD_ENCRYPT = 0x07,
|
||||
PENDING_PUBLISH = 0x08,
|
||||
/** This will be useful so the user can know if the mail reached at least
|
||||
* some friend node, in case of internet connection interruption */
|
||||
//PENDING_TRANSFER,
|
||||
PENDING_RECEIPT_RECEIVE = 0x09,
|
||||
/// Records with status >= RECEIPT_RECEIVED get deleted
|
||||
RECEIPT_RECEIVED = 0x0a,
|
||||
FAILED_RECEIPT_SIGNATURE = 0xf0,
|
||||
FAILED_ENCRYPTION = 0xf1
|
||||
};
|
||||
|
||||
typedef uint64_t RsGxsTransId;
|
||||
|
||||
class RsGxsTransGroup
|
||||
{
|
||||
public:
|
||||
|
@ -21,12 +64,22 @@ public:
|
|||
uint8_t *data ;
|
||||
};
|
||||
|
||||
struct RsGxsTransOutgoingRecord
|
||||
{
|
||||
GxsTransSendStatus status;
|
||||
RsGxsId recipient;
|
||||
uint32_t data_size ;
|
||||
GxsTransSubServices client_service;
|
||||
};
|
||||
|
||||
class RsGxsTrans: public RsGxsIfaceHelper
|
||||
{
|
||||
public:
|
||||
struct GxsTransStatistics
|
||||
{
|
||||
RsGxsGroupId prefered_group_id ;
|
||||
|
||||
std::vector<RsGxsTransOutgoingRecord> outgoing_records;
|
||||
};
|
||||
|
||||
RsGxsTrans(RsGxsIface *gxs) : RsGxsIfaceHelper(gxs) {}
|
||||
|
@ -39,4 +92,4 @@ public:
|
|||
// virtual bool getPostData(const uint32_t &token, std::vector<RsGxsTransMsg> &posts) = 0;
|
||||
};
|
||||
|
||||
extern RsGxsTrans *rsgxstrans ;
|
||||
extern RsGxsTrans *rsGxsTrans ;
|
||||
|
|
|
@ -1799,6 +1799,8 @@ int RsServer::StartupRetroShare()
|
|||
rsPosted = mPosted;
|
||||
rsGxsForums = mGxsForums;
|
||||
rsGxsChannels = mGxsChannels;
|
||||
rsGxsTrans = mGxsTrans;
|
||||
|
||||
//rsPhoto = mPhoto;
|
||||
//rsWire = mWire;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue