aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorEric Lombrozo <elombrozo@gmail.com>2013-06-05 20:21:41 -0700
committerEric Lombrozo <elombrozo@gmail.com>2013-06-05 23:15:20 -0700
commit501da2503a39dd88470df89ccc923c696fe6b111 (patch)
tree52bb9f3eb186bc99d1a8a96435fd78ac09532235 /src/net.cpp
parentaabdf9e899e9024927c26c194ad38142495f80bf (diff)
Using boost::signals2 to message main from net.cpp.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 5932f5f8e3..dc9a7e5371 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -68,27 +68,9 @@ 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;
-}
+// Signals for message handling
+static CNodeSignals g_signals;
+CNodeSignals& GetNodeSignals() { return g_signals; }
void AddOneShot(string strDest)
{
@@ -1646,7 +1628,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();
@@ -1654,8 +1636,8 @@ void ThreadMessageHandler()
// Send messages
{
TRY_LOCK(pnode->cs_vSend, lockSend);
- if (lockSend && fnSendMessages)
- fnSendMessages(pnode, pnode == pnodeTrickle);
+ if (lockSend)
+ g_signals.SendMessages(pnode, pnode == pnodeTrickle);
}
boost::this_thread::interruption_point();
}