diff options
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/net.cpp b/src/net.cpp index 54ed1d9b51..adc5f93029 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -5,7 +5,7 @@ #include "db.h" #include "net.h" -#include "init.h" +#include "core.h" #include "addrman.h" #include "ui_interface.h" #include "script.h" @@ -68,6 +68,10 @@ CCriticalSection cs_vAddedNodes; static CSemaphore *semOutbound = NULL; +// Signals for message handling +static CNodeSignals g_signals; +CNodeSignals& GetNodeSignals() { return g_signals; } + void AddOneShot(string strDest) { LOCK(cs_vOneShots); @@ -79,17 +83,6 @@ unsigned short GetListenPort() return (unsigned short)(GetArg("-port", GetDefaultPort())); } -void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd) -{ - // Filter out duplicate requests - if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd) - return; - pindexLastGetBlocksBegin = pindexBegin; - hashLastGetBlocksEnd = hashEnd; - - PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd); -} - // find 'best' local address for a particular peer bool GetLocal(CService& addr, const CNetAddr *paddrPeer) { @@ -1574,11 +1567,6 @@ void static StartSync(const vector<CNode*> &vNodes) { CNode *pnodeNewSync = NULL; double dBestScore = 0; - // fImporting and fReindex are accessed out of cs_main here, but only - // as an optimization - they are checked again in SendMessages. - if (fImporting || fReindex) - return; - // Iterate over all nodes BOOST_FOREACH(CNode* pnode, vNodes) { // check preconditions for allowing a sync @@ -1635,7 +1623,7 @@ void ThreadMessageHandler() { TRY_LOCK(pnode->cs_vRecvMsg, lockRecv); if (lockRecv) - if (!ProcessMessages(pnode)) + if (!g_signals.ProcessMessages(pnode)) pnode->CloseSocketDisconnect(); } boost::this_thread::interruption_point(); @@ -1644,7 +1632,7 @@ void ThreadMessageHandler() { TRY_LOCK(pnode->cs_vSend, lockSend); if (lockSend) - SendMessages(pnode, pnode == pnodeTrickle); + g_signals.SendMessages(pnode, pnode == pnodeTrickle); } boost::this_thread::interruption_point(); } @@ -1861,9 +1849,7 @@ void StartNode(boost::thread_group& threadGroup) bool StopNode() { printf("StopNode()\n"); - GenerateBitcoins(false, NULL); MapPort(false); - nTransactionsUpdated++; if (semOutbound) for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++) semOutbound->post(); |