mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-29 00:37:10 -05:00
created a new item to hold/save per gxs group information (statistics, update delays)
This commit is contained in:
parent
c6d21e4abc
commit
f3a34bf5a3
@ -1350,8 +1350,8 @@ class StoreHere
|
||||
{
|
||||
public:
|
||||
|
||||
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm, RsGxsServerGrpUpdateItem*& sgm)
|
||||
: mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mServerGrpUpdateItem(sgm)
|
||||
StoreHere(RsGxsNetService::ClientGrpMap& cgm, RsGxsNetService::ClientMsgMap& cmm, RsGxsNetService::ServerMsgMap& smm,RsGxsNetService::GrpConfigMap& gcm, RsGxsServerGrpUpdateItem*& sgm)
|
||||
: mClientGrpMap(cgm), mClientMsgMap(cmm), mServerMsgMap(smm), mServerGrpUpdateItem(sgm), m
|
||||
{}
|
||||
|
||||
void operator() (RsItem* item)
|
||||
@ -1360,9 +1360,12 @@ public:
|
||||
RsGxsGrpUpdateItem* gui;
|
||||
RsGxsServerGrpUpdateItem* gsui;
|
||||
RsGxsServerMsgUpdateItem* msui;
|
||||
RsGxsGrpConfigItem* mgci;
|
||||
|
||||
if((mui = dynamic_cast<RsGxsMsgUpdateItem*>(item)) != NULL)
|
||||
mClientMsgMap.insert(std::make_pair(mui->peerId, mui));
|
||||
else if((mgci = dynamic_cast<RsGxsGrpConfigItem*>(item)) != NULL)
|
||||
mGrpConfigMap.insert(std::make_pair(mgci->grpId, mgci));
|
||||
else if((gui = dynamic_cast<RsGxsGrpUpdateItem*>(item)) != NULL)
|
||||
mClientGrpMap.insert(std::make_pair(gui->peerId, gui));
|
||||
else if((msui = dynamic_cast<RsGxsServerMsgUpdateItem*>(item)) != NULL)
|
||||
@ -1389,6 +1392,8 @@ private:
|
||||
RsGxsNetService::ClientGrpMap& mClientGrpMap;
|
||||
RsGxsNetService::ClientMsgMap& mClientMsgMap;
|
||||
RsGxsNetService::ServerMsgMap& mServerMsgMap;
|
||||
RsGxsNetService::GrpConfigMap& mGrpConfigMap;
|
||||
|
||||
RsGxsServerGrpUpdateItem*& mServerGrpUpdateItem;
|
||||
|
||||
};
|
||||
@ -1443,6 +1448,7 @@ bool RsGxsNetService::saveList(bool& cleanup, std::list<RsItem*>& save)
|
||||
std::transform(mClientGrpUpdateMap.begin(), mClientGrpUpdateMap.end(), std::back_inserter(save), get_second<ClientGrpMap>());
|
||||
std::transform(mClientMsgUpdateMap.begin(), mClientMsgUpdateMap.end(), std::back_inserter(save), get_second<ClientMsgMap>());
|
||||
std::transform(mServerMsgUpdateMap.begin(), mServerMsgUpdateMap.end(), std::back_inserter(save), get_second<ServerMsgMap>());
|
||||
std::transform(mServerGrpConfigMap.begin(), mServerGrpConfigMap.end(), std::back_inserter(save), get_second<GrpConfigMap>());
|
||||
|
||||
save.push_back(mGrpServerUpdateItem);
|
||||
|
||||
|
@ -545,13 +545,13 @@ public:
|
||||
typedef std::map<RsPeerId, RsGxsMsgUpdateItem*> ClientMsgMap;
|
||||
typedef std::map<RsGxsGroupId, RsGxsServerMsgUpdateItem*> ServerMsgMap;
|
||||
typedef std::map<RsPeerId, RsGxsGrpUpdateItem*> ClientGrpMap;
|
||||
typedef std::map<RsGxsGroupId, RsGxsGrpConfigItem*> GrpConfigMap;
|
||||
private:
|
||||
|
||||
ClientMsgMap mClientMsgUpdateMap;
|
||||
ServerMsgMap mServerMsgUpdateMap;
|
||||
ClientGrpMap mClientGrpUpdateMap;
|
||||
|
||||
std::map<RsGxsGroupId,RsGroupNetworkStatsRecord> mGroupNetworkStats ;
|
||||
GrpConfigMap mServerGrpConfigMap;
|
||||
|
||||
RsGxsServerGrpUpdateItem* mGrpServerUpdateItem;
|
||||
RsServiceInfo mServiceInfo;
|
||||
|
@ -38,13 +38,33 @@
|
||||
#endif
|
||||
|
||||
#include "gxs/rsgxsdata.h"
|
||||
#include "serialiser/rstlvidset.h"
|
||||
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_GRP_UPDATE = 0x0001;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE_deprecated = 0x0002;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE = 0x0003;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE = 0x0004;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE = 0x0008;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_GRP_UPDATE = 0x01;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE_deprecated = 0x02;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_MSG_UPDATE = 0x03;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE = 0x08;
|
||||
const uint8_t RS_PKT_SUBTYPE_GXS_GRP_CONFIG = 0x09;
|
||||
|
||||
class RsGxsGrpConfigItem : public RsItem {
|
||||
public:
|
||||
RsGxsGrpConfigItem(uint16_t servType) : RsItem(RS_PKT_VERSION_SERVICE, servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {}
|
||||
virtual ~RsGxsGrpConfigItem() {}
|
||||
|
||||
virtual void clear() {}
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) { return out;}
|
||||
|
||||
RsGxsGroupId grpId ;
|
||||
uint32_t msg_keep_delay ;
|
||||
uint32_t msg_send_delay ;
|
||||
uint32_t msg_req_delay ;
|
||||
|
||||
RsTlvPeerIdSet suppliers;
|
||||
uint32_t max_visible_count ;
|
||||
time_t update_TS ;
|
||||
};
|
||||
|
||||
class RsGxsGrpUpdateItem : public RsItem {
|
||||
public:
|
||||
@ -129,27 +149,33 @@ private:
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GRP_UPDATE_ITEM */
|
||||
|
||||
virtual uint32_t sizeGxsGrpUpdate(RsGxsGrpUpdateItem* item);
|
||||
virtual bool serialiseGxsGrpUpdate(RsGxsGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsGrpUpdateItem* deserialGxsGrpUpddate(void *data, uint32_t *size);
|
||||
uint32_t sizeGxsGrpUpdate(RsGxsGrpUpdateItem* item);
|
||||
bool serialiseGxsGrpUpdate(RsGxsGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsGrpUpdateItem* deserialGxsGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GRP_SERVER_UPDATE_ITEM */
|
||||
|
||||
virtual uint32_t sizeGxsServerGrpUpdate(RsGxsServerGrpUpdateItem* item);
|
||||
virtual bool serialiseGxsServerGrpUpdate(RsGxsServerGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsServerGrpUpdateItem* deserialGxsServerGrpUpddate(void *data, uint32_t *size);
|
||||
uint32_t sizeGxsServerGrpUpdate(RsGxsServerGrpUpdateItem* item);
|
||||
bool serialiseGxsServerGrpUpdate(RsGxsServerGrpUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsServerGrpUpdateItem* deserialGxsServerGrpUpddate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_MSG_UPDATE_ITEM */
|
||||
|
||||
virtual uint32_t sizeGxsMsgUpdate(RsGxsMsgUpdateItem* item);
|
||||
virtual bool serialiseGxsMsgUpdate(RsGxsMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsMsgUpdateItem* deserialGxsMsgUpdate(void *data, uint32_t *size);
|
||||
uint32_t sizeGxsMsgUpdate(RsGxsMsgUpdateItem* item);
|
||||
bool serialiseGxsMsgUpdate(RsGxsMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsMsgUpdateItem* deserialGxsMsgUpdate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_SERVER_UPDATE_ITEM */
|
||||
|
||||
virtual uint32_t sizeGxsServerMsgUpdate(RsGxsServerMsgUpdateItem* item);
|
||||
virtual bool serialiseGxsServerMsgUpdate(RsGxsServerMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
virtual RsGxsServerMsgUpdateItem* deserialGxsServerMsgUpdate(void *data, uint32_t *size);
|
||||
uint32_t sizeGxsServerMsgUpdate(RsGxsServerMsgUpdateItem* item);
|
||||
bool serialiseGxsServerMsgUpdate(RsGxsServerMsgUpdateItem *item, void *data, uint32_t *size);
|
||||
RsGxsServerMsgUpdateItem* deserialGxsServerMsgUpdate(void *data, uint32_t *size);
|
||||
|
||||
/* for RS_PKT_SUBTYPE_GXS_CONFIG */
|
||||
|
||||
uint32_t sizeGxsGrpConfig(RsGxsGrpConfigItem* item);
|
||||
bool serialiseGxsGrpConfig(RsGxsGrpConfigItem *item, void *data, uint32_t *size);
|
||||
RsGxsGrpConfigItem* deserialGxsGrpConfig(void *data, uint32_t *size);
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user