1
I have a fundamental doubt wrt boost signaling used in bitcoin. As far as I understand the following happens between main.cpp and init.cpp:
StartNode()spawns a threadThreadMessageHandlerThreadMessageHandlerissues a boost signalSendMessagesSendMessages()does the sending of messages (likePINGorINV)
Is my understanding correct? Why do we invoke a boost signal and complicate ? Why not a simple function call to SendMessages() in main.cpp would not do the equivalent?
Any expert please explain the flow of code here.
Update
Code Snippet1 (Original Bitcoin)
if (lockSend)
g_signals.SendMessages(pnode);
Code Snippet2 (My Attempt):
if (lockSend)
SendMessages(pnode);
When would you call it? – David Schwartz – 2016-01-08T08:00:08.043
Please see my update (Snippets). Is that not equivalent? Anyway there are some checks inside
ProcessMessages()after which real messages are pushed. Like for Ping to happen -- one will need wait tillPING_INTERVALor manually issue it. All these are anyway checked in the function. – Guhan S – 2016-01-08T08:55:00.507