mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Removed net.cpp's dependency on init.h.
Added explicit include of main.h in init.cpp, changed include of init.h to include of main.h in net.cpp. Added function registration for net.cpp in init.cpp's network initialization. Removed protocol.cpp's dependency on main.h. TODO: Remove main.h include in net.cpp.
This commit is contained in:
28
src/net.cpp
28
src/net.cpp
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "db.h"
|
||||
#include "net.h"
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
#include "addrman.h"
|
||||
#include "ui_interface.h"
|
||||
#include "script.h"
|
||||
@@ -68,6 +68,28 @@ CCriticalSection cs_vAddedNodes;
|
||||
|
||||
static CSemaphore *semOutbound = NULL;
|
||||
|
||||
//
|
||||
// Handlers that need to be registered
|
||||
//
|
||||
static ProcessMessagesHandler fnProcessMessages = NULL;
|
||||
static SendMessagesHandler fnSendMessages = NULL;
|
||||
static StartShutdownHandler fnStartShutdown = NULL;
|
||||
|
||||
void SetProcessMessagesHandler(ProcessMessagesHandler handler)
|
||||
{
|
||||
fnProcessMessages = handler;
|
||||
}
|
||||
|
||||
void SetSendMessagesHandler(SendMessagesHandler handler)
|
||||
{
|
||||
fnSendMessages = handler;
|
||||
}
|
||||
|
||||
void SetStartShutdownHandler(StartShutdownHandler handler)
|
||||
{
|
||||
fnStartShutdown = handler;
|
||||
}
|
||||
|
||||
void AddOneShot(string strDest)
|
||||
{
|
||||
LOCK(cs_vOneShots);
|
||||
@@ -1632,8 +1654,8 @@ void ThreadMessageHandler()
|
||||
// Send messages
|
||||
{
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend)
|
||||
SendMessages(pnode, pnode == pnodeTrickle);
|
||||
if (lockSend && fnSendMessages)
|
||||
fnSendMessages(pnode, pnode == pnodeTrickle);
|
||||
}
|
||||
boost::this_thread::interruption_point();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user