X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fnet.h;h=a98a41641d0ac7babb1ec71a1cf3806b1c5991c1;hb=9d14e64825d95061ea0857267646dfcb3d62e07a;hp=56a33913128953c979508e540bc0758dd53c436f;hpb=5e16a8b47dcc39875b55e578ba1c4dd929fa1332;p=novacoin.git diff --git a/src/net.h b/src/net.h index 56a3391..a98a416 100644 --- a/src/net.h +++ b/src/net.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_NET_H #define BITCOIN_NET_H +#include #include #ifndef Q_MOC_RUN #include @@ -18,7 +19,6 @@ #include "mruset.h" #include "netbase.h" -#include "protocol.h" #include "addrman.h" #include "hash.h" @@ -27,6 +27,8 @@ class CNode; class CBlockIndex; extern int nBestHeight; +const uint16_t nSocksDefault = 9050; +const uint16_t nPortZero = 0; inline uint64_t ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); } @@ -39,6 +41,7 @@ void AddressCurrentlyConnected(const CService& addr); CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CService& ip); CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64_t nTimeout=0); +bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false); void MapPort(); unsigned short GetListenPort(); bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string())); @@ -50,7 +53,6 @@ enum LOCAL_NONE, // unknown LOCAL_IF, // address a local interface listens on LOCAL_BIND, // address explicit bound to - LOCAL_UPNP, // address reported by UPnP LOCAL_IRC, // address reported by IRC (deprecated) LOCAL_HTTP, // address reported by whatismyip.com and similar LOCAL_MANUAL, // address explicitly specified (-externalip=) @@ -74,7 +76,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL); enum { MSG_TX = 1, - MSG_BLOCK, + MSG_BLOCK }; class CRequestTracker @@ -103,20 +105,19 @@ enum threadId THREAD_OPENCONNECTIONS, THREAD_MESSAGEHANDLER, THREAD_RPCLISTENER, - THREAD_UPNP, THREAD_DNSSEED, THREAD_ADDEDCONNECTIONS, THREAD_DUMPADDRESS, THREAD_RPCHANDLER, THREAD_MINTER, THREAD_SCRIPTCHECK, + THREAD_NTP, THREAD_MAX }; extern bool fClient; extern bool fDiscover; -extern bool fUseUPnP; extern uint64_t nLocalServices; extern uint64_t nLocalHostNonce; extern CAddress addrSeenByPeer; @@ -232,7 +233,7 @@ public: nLastSendEmpty = GetTime(); nTimeConnected = GetTime(); nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = std::numeric_limits::max(); addr = addrIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; nVersion = 0; @@ -264,8 +265,7 @@ public: { if (hSocket != INVALID_SOCKET) { - closesocket(hSocket); - hSocket = INVALID_SOCKET; + CloseSocket(hSocket); } } @@ -374,7 +374,7 @@ public: return; vSend.resize(nHeaderStart); nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = std::numeric_limits::max(); LEAVE_CRITICAL_SECTION(cs_vSend); if (fDebug) @@ -409,7 +409,7 @@ public: } nHeaderStart = -1; - nMessageStart = -1; + nMessageStart = std::numeric_limits::max(); LEAVE_CRITICAL_SECTION(cs_vSend); }