start hook_packets on separate boost thread.
This commit is contained in:
parent
64e68be07d
commit
bd5d576076
@ -392,10 +392,10 @@ static inline void
|
|||||||
jstx_to_ctx(const Local<Object> jstx, CTransaction& ctx);
|
jstx_to_ctx(const Local<Object> jstx, CTransaction& ctx);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hook_packets(CNodeSignals& nodeSignals);
|
hook_packets(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unhook_packets(CNodeSignals& nodeSignals);
|
unhook_packets(void);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
process_packets(CNode* pfrom);
|
process_packets(CNode* pfrom);
|
||||||
@ -738,7 +738,7 @@ start_node(void) {
|
|||||||
signal(SIGQUIT, SIG_DFL);
|
signal(SIGQUIT, SIG_DFL);
|
||||||
|
|
||||||
// Hook into packet handling
|
// Hook into packet handling
|
||||||
hook_packets(GetNodeSignals());
|
(boost::thread *)new boost::thread(boost::bind(&hook_packets));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -886,7 +886,7 @@ NAN_METHOD(StopBitcoind) {
|
|||||||
static void
|
static void
|
||||||
async_stop_node(uv_work_t *req) {
|
async_stop_node(uv_work_t *req) {
|
||||||
async_node_data *data = static_cast<async_node_data*>(req->data);
|
async_node_data *data = static_cast<async_node_data*>(req->data);
|
||||||
unhook_packets(GetNodeSignals());
|
unhook_packets();
|
||||||
StartShutdown();
|
StartShutdown();
|
||||||
data->result = std::string("stop_node(): bitcoind shutdown.");
|
data->result = std::string("stop_node(): bitcoind shutdown.");
|
||||||
}
|
}
|
||||||
@ -2748,12 +2748,14 @@ NAN_METHOD(HookPackets) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hook_packets(CNodeSignals& nodeSignals) {
|
hook_packets(void) {
|
||||||
|
CNodeSignals& nodeSignals = GetNodeSignals();
|
||||||
nodeSignals.ProcessMessages.connect(&process_packets);
|
nodeSignals.ProcessMessages.connect(&process_packets);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unhook_packets(CNodeSignals& nodeSignals) {
|
unhook_packets(void) {
|
||||||
|
CNodeSignals& nodeSignals = GetNodeSignals();
|
||||||
nodeSignals.ProcessMessages.disconnect(&process_packets);
|
nodeSignals.ProcessMessages.disconnect(&process_packets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user