mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
added new virtual method to refuse incoming msgs (similar to groups) in RsGenExchange, and used it in p3GxsTrans to refuse msgs from peers who send too much
This commit is contained in:
parent
f62028b2c1
commit
09ff94c9ec
4 changed files with 115 additions and 4 deletions
|
@ -57,6 +57,14 @@ struct GxsTransClient
|
|||
GxsTransSendStatus status ) = 0;
|
||||
};
|
||||
|
||||
struct MsgSizeCount
|
||||
{
|
||||
MsgSizeCount() : size(0),count(0) {}
|
||||
|
||||
uint32_t size ;
|
||||
uint32_t count ;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief p3GxsTrans is a mail delivery service based on GXS.
|
||||
* p3GxsTrans is capable of asynchronous mail delivery and acknowledgement.
|
||||
|
@ -159,7 +167,7 @@ private:
|
|||
* Two weeks seems fair ATM.
|
||||
*/
|
||||
static const uint32_t GXS_STORAGE_PERIOD = 0x127500;
|
||||
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS = 1203; // every 20 mins. Could be less.
|
||||
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS ; // every 20 mins. Could be less.
|
||||
|
||||
time_t mLastMsgCleanup ;
|
||||
|
||||
|
@ -290,14 +298,24 @@ private:
|
|||
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
|
||||
|
||||
void getMessagesToDelete(GxsMsgReq& req) ;
|
||||
void getPerUserStatistics(std::map<RsGxsId,MsgSizeCount>& m) ;
|
||||
|
||||
private:
|
||||
RsGeneralDataService* const mDs;
|
||||
RsMutex mMtx ;
|
||||
|
||||
GxsMsgReq mMsgToDel ;
|
||||
std::map<RsGxsId,MsgSizeCount> total_message_size_and_count;
|
||||
};
|
||||
|
||||
// Overloaded from RsGenExchange.
|
||||
|
||||
bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta) ;
|
||||
|
||||
GxsTransIntegrityCleanupThread *mCleanupThread ;
|
||||
|
||||
// statistics of the load across all groups, per user.
|
||||
|
||||
std::map<RsGxsId,MsgSizeCount> per_user_statistics ;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue