aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Ensure we meet the BIP 152 old-relay-types response requirementsMatt Corallo2017-01-051-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to do this, we must call ActivateBestChain prior to responding getdata requests for blocks which we announced using compact blocks. For getheaders responses we dont need code changes, but do note that we must reset the bestHeaderSent so that the SendMessages call re-announces the header in question. While we could do something smarter for getblocks, calling ActivateBestChain is simple and more obviously correct, instead of doing something more similar to getheaders. See-also the BIP clarifications at https://github.com/bitcoin/bips/pull/486
| * | | Cache most-recently-connected compact blockMatt Corallo2017-01-051-9/+22
| | | |
| * | | Cache most-recently-announced block's shared_ptrMatt Corallo2017-01-051-11/+40
| | | |
| * | | Relay compact block messages prior to full block connectionMatt Corallo2017-01-051-0/+33
| | | |
| * | | Make CBlockIndex*es in net_processing constMatt Corallo2017-01-041-24/+24
| | | |
* | | | Merge #9441: Net: Massive speedup. Net locks overhaulPieter Wuille2017-01-131-48/+30
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e60360e net: remove cs_vRecvMsg (Cory Fields) 991955e net: add a flag to indicate when a node's send buffer is full (Cory Fields) c6e8a9b net: add a flag to indicate when a node's process queue is full (Cory Fields) 4d712e3 net: add a new message queue for the message processor (Cory Fields) c5a8b1b net: rework the way that the messagehandler sleeps (Cory Fields) c72cc88 net: remove useless comments (Cory Fields) ef7b5ec net: Add a simple function for waking the message handler (Cory Fields) f5c36d1 net: record bytes written before notifying the message processor (Cory Fields) 60befa3 net: handle message accounting in ReceiveMsgBytes (Cory Fields) 56212e2 net: set message deserialization version when it's actually time to deserialize (Cory Fields) 0e973d9 net: remove redundant max sendbuffer size check (Cory Fields) 6042587 net: wait until the node is destroyed to delete its recv buffer (Cory Fields) f6315e0 net: only disconnect if fDisconnect has been set (Cory Fields) 5b4a8ac net: make GetReceiveFloodSize public (Cory Fields) e5bcd9c net: make vRecvMsg a list so that we can use splice() (Cory Fields) 53ad9a1 net: fix typo causing the wrong receive buffer size (Cory Fields)
| * | | | net: remove cs_vRecvMsgCory Fields2017-01-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vRecvMsg is now only touched by the socket handler thread. The accounting vars (nRecvBytes/nLastRecv/mapRecvBytesPerMsgCmd) are also only used by the socket handler thread, with the exception of queries from rpc/gui. These accesses are not threadsafe, but they never were. This needs to be addressed separately. Also, update comment describing data flow
| * | | | net: add a flag to indicate when a node's send buffer is fullCory Fields2017-01-121-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the recv flag, but this one indicates whether or not the net's send buffer is full. The socket handler checks the send queue when a new message is added and pauses if necessary, and possibly unpauses after each message is drained from its buffer.
| * | | | net: add a flag to indicate when a node's process queue is fullCory Fields2017-01-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Messages are dumped very quickly from the socket handler to the processor, so it's the depth of the processing queue that's interesting. The socket handler checks the process queue's size during the brief message hand-off and pauses if necessary, and the processor possibly unpauses each time a message is popped off of its queue.
| * | | | net: add a new message queue for the message processorCory Fields2017-01-121-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This separates the storage of messages from the net and queued messages for processing, allowing the locks to be split.
| * | | | net: rework the way that the messagehandler sleepsCory Fields2017-01-121-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | net: remove useless commentsCory Fields2017-01-121-8/+0
| | | | |
| * | | | net: set message deserialization version when it's actually time to deserializeCory Fields2017-01-041-0/+1
| | | | | | | | | | | | | | | | | | | | We'll soon no longer have access to vRecvMsg, and this is more intuitive anyway.
| * | | | net: remove redundant max sendbuffer size checkCory Fields2017-01-041-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This is left-over from before there was proper accounting. Hitting 2x the sendbuffer size should not be possible.
| * | | | net: make vRecvMsg a list so that we can use splice()Cory Fields2017-01-041-1/+1
| |/ / /
* | | | Merge #9261: Add unstored orphans with rejected parents to recentRejectsWladimir J. van der Laan2017-01-121-0/+3
|\ \ \ \ | |_|_|/ |/| | | | | | | dfbe0d5 Add unstored orphans with rejected parents to recentRejects (Alex Morcos)
| * | | Add unstored orphans with rejected parents to recentRejectsAlex Morcos2016-12-031-0/+3
| | | |
* | | | Break addnode out from the outbound connection limits.Gregory Maxwell2017-01-051-0/+2
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously addnodes were in competition with outbound connections for access to the eight outbound slots. One result of this is that frequently a node with several addnode configured peers would end up connected to none of them, because while the addnode loop was in its two minute sleep the automatic connection logic would fill any free slots with random peers. This is particularly unwelcome to users trying to maintain links to specific nodes for fast block relay or purposes. Another result is that a group of nine or more nodes which are have addnode configured towards each other can become partitioned from the public network. This commit introduces a new limit of eight connections just for addnode peers which is not subject to any of the other connection limitations (including maxconnections). The choice of eight is sufficient so that under no condition would a user find themselves connected to fewer addnoded peers than previously. It is also low enough that users who are confused about the significance of more connections and have gotten too copy-and-paste happy will not consume more than twice the slot usage of a typical user. Any additional load on the network resulting from this will likely be offset by a reduction in users applying even more wasteful workaround for the prior behavior. The retry delays are reduced to avoid nodes sitting around without their added peers up, but are still sufficient to prevent overly aggressive repeated connections. The reduced delays also make the system much more responsive to the addnode RPC. Ban-disconnects are also exempted for peers added via addnode since the outbound addnode logic ignores bans. Previously it would ban an addnode then immediately reconnect to it. A minor change was also made to CSemaphoreGrant so that it is possible to re-acquire via an object whos grant was moved.
* | | Merge #9283: A few more CTransactionRef optimizationsWladimir J. van der Laan2017-01-041-14/+17
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | | Convert COrphanTx to keep a CTransactionRefPieter Wuille2016-12-211-12/+13
| | | |
| * | | Make AcceptToMemoryPool take CTransactionRefPieter Wuille2016-12-211-3/+5
| | |/ | |/|
* | | net: remove thread_interrupted catchCory Fields2017-01-031-3/+0
| | | | | | | | | | | | | | | This is now a std::thread, so there's no hope of catching a boost interruption point.
* | | net: make net processing interruptibleCory Fields2017-01-031-14/+19
| | |
* | | Merge #9252: Release cs_main before calling ProcessNewBlock, or processing ↵Pieter Wuille2017-01-031-4/+22
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | | Release cs_main before processing cmpctblock as headerSuhas Daftuar2016-12-261-2/+9
| | | |
| * | | Release cs_main before calling ProcessNewBlock (cmpctblock handling)Suhas Daftuar2016-12-261-2/+13
| |/ /
* | | Un-expose mapArgs from utils.hMatt Corallo2016-12-241-1/+1
| | |
* | | Introduce (and use) an IsArgSet accessor methodMatt Corallo2016-12-231-1/+1
|/ /
* | Merge #8589: Inline CTxInWitness inside CTxInWladimir J. van der Laan2016-12-211-2/+2
|\ \ | | | | | | | | | f6fb7ac Move CTxInWitness inside CTxIn (Pieter Wuille)
| * | Move CTxInWitness inside CTxInPieter Wuille2016-12-041-2/+2
| | |
* | | Merge #9352: Attempt reconstruction from all compact block announcementsWladimir J. van der Laan2016-12-191-0/+45
|\ \ \ | | | | | | | | | | | | | | | | 813ede9 [qa] Update compactblocks test for multi-peer reconstruction (Suhas Daftuar) 7017298 Allow compactblock reconstruction when block is in flight (Suhas Daftuar)
| * | | Allow compactblock reconstruction when block is in flightSuhas Daftuar2016-12-151-0/+45
| | | |
* | | | If we don't allow free txs, always send a fee filter (take 2)MarcoFalke2016-12-161-3/+3
| | | |
* | | | Merge #9313: If we don't allow free txs, always send a fee filterWladimir J. van der Laan2016-12-151-0/+3
|\ \ \ \ | |/ / / |/| | | | | | | 01fea7a If we don't allow free txs, always send a fee filter (Alex Morcos)
| * | | If we don't allow free txs, always send a fee filterAlex Morcos2016-12-091-0/+3
| | | |
* | | | Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlockWladimir J. van der Laan2016-12-141-2/+2
|\ \ \ \ | | | | | | | | | | | | | | | a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)
| * | | | Remove unused CDiskBlockPos* argument from ProcessNewBlockMatt Corallo2016-12-041-2/+2
| | | | |
* | | | | Do not run functions with necessary side-effects in assert()Gregory Maxwell2016-12-141-2/+4
| |/ / / |/| | |
* | | | Merge #9268: Fix rounding privacy leak introduced in #9260Pieter Wuille2016-12-061-1/+2
|\ \ \ \ | | | | | | | | | | | | | | | 9b9324e Fix rounding privacy leak introduced in #9260 (Matt Corallo)
| * | | | Fix rounding privacy leak introduced in #9260Matt Corallo2016-12-021-1/+2
| | |_|/ | |/| |
* | | | Merge #9269: Align struct COrphan definitionWladimir J. van der Laan2016-12-051-0/+1
|\ \ \ \ | |_|_|/ |/| | | | | | | 2efc438 Align struct COrphan definition (Pieter Wuille)
| * | | Align struct COrphan definitionPieter Wuille2016-12-051-0/+1
| |/ /
* | | Merge #9014: Fix block-connection performance regressionWladimir J. van der Laan2016-12-051-8/+8
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | 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)
| * | Switch pblock in ProcessNewBlock to a shared_ptrMatt Corallo2016-12-041-8/+8
| |/ | | | | | | | | This (finally) fixes a performance regression in b3b3c2a5623d5c942d2b3565cc2d833c65105555
* / Make CTransaction actually immutablePieter Wuille2016-12-021-2/+1
|/
* Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo2016-12-021-1/+1
|
* Move network-msg-processing code out of main to its own fileMatt Corallo2016-12-021-0/+3026