Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

netfulfilledman.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2019 The Dash Core developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef NETFULFILLEDMAN_H
6 #define NETFULFILLEDMAN_H
7 
8 #include <netaddress.h>
9 #include <serialize.h>
10 #include <sync.h>
11 
14 
15 // Fulfilled requests are used to prevent nodes from asking for the same data on sync
16 // and from being banned for doing so too often.
18 {
19 private:
20  typedef std::map<std::string, int64_t> fulfilledreqmapentry_t;
21  typedef std::map<CService, fulfilledreqmapentry_t> fulfilledreqmap_t;
22 
23  //keep track of what node has/was asked for and when
26 
27  void RemoveFulfilledRequest(const CService& addr, const std::string& strRequest);
28 
29 public:
31 
33 
34  template <typename Stream, typename Operation>
35  inline void SerializationOp(Stream& s, Operation ser_action) {
38  }
39 
40  void AddFulfilledRequest(const CService& addr, const std::string& strRequest);
41  bool HasFulfilledRequest(const CService& addr, const std::string& strRequest);
42 
43  void RemoveAllFulfilledRequests(const CService& addr);
44 
45  void CheckAndRemove();
46  void Clear();
47 
48  std::string ToString() const;
49 
50  void DoMaintenance();
51 };
52 
53 #endif
bool HasFulfilledRequest(const CService &addr, const std::string &strRequest)
void RemoveFulfilledRequest(const CService &addr, const std::string &strRequest)
#define READWRITE(obj)
Definition: serialize.h:165
void SerializationOp(Stream &s, Operation ser_action)
std::map< std::string, int64_t > fulfilledreqmapentry_t
std::map< CService, fulfilledreqmapentry_t > fulfilledreqmap_t
#define LOCK(cs)
Definition: sync.h:178
CCriticalSection cs_mapFulfilledRequests
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:143
CNetFulfilledRequestManager netfulfilledman
std::string ToString() const
fulfilledreqmap_t mapFulfilledRequests
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the re...
Definition: sync.h:94
void AddFulfilledRequest(const CService &addr, const std::string &strRequest)
void RemoveAllFulfilledRequests(const CService &addr)
Released under the MIT license