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 thread ThreadMessageHandler
  • ThreadMessageHandler issues a boost signal SendMessages
  • SendMessages() does the sending of messages (like PING or INV)

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.


Code Snippet1 (Original Bitcoin)

if (lockSend)

Code Snippet2 (My Attempt):

if (lockSend)
| improve this question | | | | |
  • When would you call it? – David Schwartz Jan 8 '16 at 8:00
  • 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 till PING_INTERVAL or manually issue it. All these are anyway checked in the function. – Guhan S Jan 8 '16 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.