#include <arpa/inet.h>
#endif
+#include "mruset.h"
#include "netbase.h"
#include "protocol.h"
+#include "addrman.h"
class CAddrDB;
class CRequestTracker;
bool RecvLine(SOCKET hSocket, std::string& strLine);
bool GetMyExternalIP(CNetAddr& ipRet);
-bool AddAddress(CAddress addr, int64 nTimePenalty=0, CAddrDB *pAddrDB=NULL);
void AddressCurrentlyConnected(const CService& addr);
CNode* FindNode(const CNetAddr& ip);
CNode* FindNode(const CService& ip);
};
-
+/** Thread types */
enum threadId
{
THREAD_SOCKETHANDLER,
THREAD_UPNP,
THREAD_DNSSEED,
THREAD_ADDEDCONNECTIONS,
+ THREAD_DUMPADDRESS,
THREAD_MAX
};
extern CAddress addrLocalHost;
extern uint64 nLocalHostNonce;
extern boost::array<int, THREAD_MAX> vnThreadsRunning;
+extern CAddrMan addrman;
extern std::vector<CNode*> vNodes;
extern CCriticalSection cs_vNodes;
-extern std::map<std::vector<unsigned char>, CAddress> mapAddresses;
-extern CCriticalSection cs_mapAddresses;
extern std::map<CInv, CDataStream> mapRelay;
extern std::deque<std::pair<int64, CInv> > vRelayExpiration;
extern CCriticalSection cs_mapRelay;
-
+/** Information about a peer */
class CNode
{
public:
int64 nLastRecv;
int64 nLastSendEmpty;
int64 nTimeConnected;
- unsigned int nHeaderStart;
+ signed int nHeaderStart;
unsigned int nMessageStart;
CAddress addr;
int nVersion;
std::set<uint256> setKnown;
// inventory based relay
- std::set<CInv> setInventoryKnown;
+ mruset<CInv> setInventoryKnown;
std::vector<CInv> vInventoryToSend;
CCriticalSection cs_inventory;
std::multimap<int64, CInv> mapAskFor;
fGetAddr = false;
vfSubscribe.assign(256, false);
nMisbehavior = 0;
+ setInventoryKnown.max_size(SendBufferSize() / 1000);
// Be shy and don't send version until we hear
if (!fInbound)