X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fnet.h;h=bf8ed806668954302332c19099bea5398cbccf35;hb=d11488abd05cb39a9f481e7c4c35f780197a3d28;hp=e3e92dad84a87584ba8c3a41da08c43c27938e11;hpb=18c0fa97d0408a3ee8e4cb39c08156f7667f99ac;p=novacoin.git diff --git a/src/net.h b/src/net.h index e3e92da..bf8ed80 100644 --- a/src/net.h +++ b/src/net.h @@ -1,7 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NET_H #define BITCOIN_NET_H @@ -14,8 +14,10 @@ #include #endif +#include "mruset.h" #include "netbase.h" #include "protocol.h" +#include "addrman.h" class CAddrDB; class CRequestTracker; @@ -29,8 +31,8 @@ inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer" inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 10*1000); } static const unsigned int PUBLISH_HOPS = 5; +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); @@ -67,7 +69,7 @@ public: }; - +/** Thread types */ enum threadId { THREAD_SOCKETHANDLER, @@ -78,6 +80,7 @@ enum threadId THREAD_UPNP, THREAD_DNSSEED, THREAD_ADDEDCONNECTIONS, + THREAD_DUMPADDRESS, THREAD_MAX }; @@ -88,11 +91,10 @@ extern uint64 nLocalServices; extern CAddress addrLocalHost; extern uint64 nLocalHostNonce; extern boost::array vnThreadsRunning; +extern CAddrMan addrman; extern std::vector vNodes; extern CCriticalSection cs_vNodes; -extern std::map, CAddress> mapAddresses; -extern CCriticalSection cs_mapAddresses; extern std::map mapRelay; extern std::deque > vRelayExpiration; extern CCriticalSection cs_mapRelay; @@ -103,7 +105,7 @@ extern std::map mapAlreadyAskedFor; - +/** Information about a peer */ class CNode { public: @@ -118,7 +120,7 @@ public: int64 nLastRecv; int64 nLastSendEmpty; int64 nTimeConnected; - unsigned int nHeaderStart; + signed int nHeaderStart; unsigned int nMessageStart; CAddress addr; int nVersion; @@ -153,7 +155,7 @@ public: std::set setKnown; // inventory based relay - std::set setInventoryKnown; + mruset setInventoryKnown; std::vector vInventoryToSend; CCriticalSection cs_inventory; std::multimap mapAskFor; @@ -192,6 +194,7 @@ public: 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)