Commit graph

35 commits

Author SHA1 Message Date
Cory Fields
4d712e366c net: add a new message queue for the message processor
This separates the storage of messages from the net and queued messages for
processing, allowing the locks to be split.
2017-01-12 23:05:25 -05:00
Cory Fields
c5a8b1b946 net: rework the way that the messagehandler sleeps
In order to sleep accurately, the message handler needs to know if _any_ node
has more processing that it should do before the entire thread sleeps.

Rather than returning a value that represents whether ProcessMessages
encountered a message that should trigger a disconnnect, interpret the return
value as whether or not that node has more work to do.

Also, use a global fProcessWake value that can be set by other threads,
which takes precedence (for one cycle) over the messagehandler's decision.

Note that the previous behavior was to only process one message per loop
(except in the case of a bad checksum or invalid header). That was changed in
PR #3180.

The only change here in that regard is that the current node now falls to the
back of the processing queue for the bad checksum/invalid header cases.
2017-01-12 23:05:24 -05:00
Cory Fields
c72cc88ed3 net: remove useless comments 2017-01-12 23:05:09 -05:00
Cory Fields
56212e20ac net: set message deserialization version when it's actually time to deserialize
We'll soon no longer have access to vRecvMsg, and this is more intuitive anyway.
2017-01-04 10:10:35 -05:00
Cory Fields
0e973d970a net: remove redundant max sendbuffer size check
This is left-over from before there was proper accounting. Hitting 2x the
sendbuffer size should not be possible.
2017-01-04 10:10:35 -05:00
Cory Fields
e5bcd9c84f net: make vRecvMsg a list so that we can use splice() 2017-01-04 09:29:14 -05:00
Wladimir J. van der Laan
869781c51c
Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2017-01-04 12:23:10 +01:00
Cory Fields
5cb0fcee81 net: remove thread_interrupted catch
This is now a std::thread, so there's no hope of catching a boost interruption
point.
2017-01-03 17:56:21 -05:00
Cory Fields
d3d7056d2a net: make net processing interruptible 2017-01-03 17:56:20 -05:00
Pieter Wuille
ce5c1f4aca
Merge #9252: Release cs_main before calling ProcessNewBlock, or processing headers (cmpctblock handling)
bd02bdd Release cs_main before processing cmpctblock as header (Suhas Daftuar)
680b0c0 Release cs_main before calling ProcessNewBlock (cmpctblock handling) (Suhas Daftuar)
2017-01-03 13:52:16 -08:00
Suhas Daftuar
bd02bddb93 Release cs_main before processing cmpctblock as header 2016-12-26 05:34:54 -05:00
Suhas Daftuar
680b0c0138 Release cs_main before calling ProcessNewBlock (cmpctblock handling) 2016-12-26 05:30:26 -05:00
Matt Corallo
4cd373aea8 Un-expose mapArgs from utils.h 2016-12-24 11:29:33 -05:00
Matt Corallo
0cf86a6678 Introduce (and use) an IsArgSet accessor method 2016-12-23 21:30:16 -05:00
Pieter Wuille
62607d796c Convert COrphanTx to keep a CTransactionRef 2016-12-21 18:18:28 -08:00
Pieter Wuille
c44e4c467c Make AcceptToMemoryPool take CTransactionRef 2016-12-21 18:18:23 -08:00
Wladimir J. van der Laan
e8cfe1ee2d
Merge #8589: Inline CTxInWitness inside CTxIn
f6fb7ac Move CTxInWitness inside CTxIn (Pieter Wuille)
2016-12-21 14:04:06 +01:00
Wladimir J. van der Laan
a7f76512d9
Merge #9352: Attempt reconstruction from all compact block announcements
813ede9 [qa] Update compactblocks test for multi-peer reconstruction (Suhas Daftuar)
7017298 Allow compactblock reconstruction when block is in flight (Suhas Daftuar)
2016-12-19 08:52:42 +01:00
MarcoFalke
fa16b8fdba If we don't allow free txs, always send a fee filter (take 2) 2016-12-16 14:27:55 +01:00
Wladimir J. van der Laan
756374c522
Merge #9313: If we don't allow free txs, always send a fee filter
01fea7a If we don't allow free txs, always send a fee filter (Alex Morcos)
2016-12-15 19:45:54 +01:00
Suhas Daftuar
7017298eb2 Allow compactblock reconstruction when block is in flight 2016-12-15 11:47:04 -05:00
Wladimir J. van der Laan
b68685a16a
Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlock
a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)
2016-12-14 10:56:28 +01:00
Gregory Maxwell
da9cdd2c9c Do not run functions with necessary side-effects in assert() 2016-12-14 01:50:00 +00:00
Alex Morcos
01fea7a048 If we don't allow free txs, always send a fee filter 2016-12-09 15:25:46 -05:00
Pieter Wuille
09c4fd157c
Merge #9268: Fix rounding privacy leak introduced in #9260
9b9324e Fix rounding privacy leak introduced in #9260 (Matt Corallo)
2016-12-06 13:33:01 -08:00
Wladimir J. van der Laan
43e8150ef6
Merge #9269: Align struct COrphan definition
2efc438 Align struct COrphan definition (Pieter Wuille)
2016-12-05 11:09:26 +01:00
Pieter Wuille
2efc43874c Align struct COrphan definition 2016-12-05 00:35:07 -08:00
Pieter Wuille
f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Wladimir J. van der Laan
d04aebaec7
Merge #9014: Fix block-connection performance regression
dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)
2016-12-05 08:07:45 +01:00
Matt Corallo
a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo
2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Matt Corallo
9b9324ee49 Fix rounding privacy leak introduced in #9260 2016-12-02 21:30:36 -08:00
Pieter Wuille
81e3228fcb Make CTransaction actually immutable 2016-12-02 18:37:43 -08:00
Matt Corallo
76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Matt Corallo
e736772c56 Move network-msg-processing code out of main to its own file 2016-12-02 09:42:51 -08:00