aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
AgeCommit message (Collapse)Author
2013-09-18Replace printf with LogPrintf / LogPrintGavin Andresen
2013-08-20Performance optimization for bloom filters.Gregory Maxwell
This reduces a peer's ability to attack network resources by using a full bloom filter, but without reducing the usability of bloom filters. It sets a default match everything filter for peers and it generalizes a prior optimization to cover more cases.
2013-06-06Removed the main.h include from net.cpp.Eric Lombrozo
2013-06-05Using boost::signals2 to message main from net.cpp.Eric Lombrozo
2013-06-05Removed net.cpp's dependency on init.h.Eric Lombrozo
Added explicit include of main.h in init.cpp, changed include of init.h to include of main.h in net.cpp. Added function registration for net.cpp in init.cpp's network initialization. Removed protocol.cpp's dependency on main.h. TODO: Remove main.h include in net.cpp.
2013-06-05Moved PushGetBlocks to main.cpp to eliminate dependence of net.cpp on ↵Eric Lombrozo
CBlockLocator.
2013-04-30Don't announce to non-peer CNodesPieter Wuille
2013-04-29Try to increase file descriptor rlimit if necessaryPieter Wuille
As the default can be too low, especially on OSX.
2013-04-09Merge pull request #2461 from sipa/syncnodeGavin Andresen
Make sure we always have a node to do IBD from
2013-04-07Add bytessent, bytesrecv and syncnode to getpeerinfoPieter Wuille
2013-04-07Make sure we always have a node to do IBD fromPieter Wuille
This introduces the concept of the 'sync node', which is the one we asked for missing blocks. In case the sync node goes away, a new one will be selected. For now, the heuristic is very simple, but it can easily be extended later to add better policies.
2013-04-04Drop release times for CNodePieter Wuille
It seems there were two mechanisms for assessing whether a CNode was still in use: a refcount and a release timestamp. The latter seems to have been there for a long time, as a safety mechanism. However, this timer also keeps CNode objects alive for far longer than necessary after disconnects, potentially opening up a DoS window. This commit removes the timestamp-based mechanism, and replaces it with an assert(nRefCount >= 0), to verify that the refcounting is indeed correctly working.
2013-04-03Merge pull request #2423 from TheBlueMatt/limitedmapalreadyaskedforGavin Andresen
Limited mapAlreadyAskedFor
2013-04-03Clean up shutdown processGavin Andresen
2013-04-03Port Thread* methods to boost::thread_groupGavin Andresen
2013-04-03Shutdown cleanup prep-workGavin Andresen
Create a boost::thread_group object at the qt/bitcoind main-loop level that will hold pointers to all the main-loop threads. This will replace the vnThreadsRunning[] array. For testing, ported the BitcoinMiner threads to use its own boost::thread_group.
2013-04-01Move mapAlreadyAskedFor to limitedmapMatt Corallo
This will result in re-requesting invs if we are under heavy inv load, however as long as we get no more than 16,000 invs in two minutes, this should have no effect on runtime behavior.
2013-03-30Process getdata invs separately until send buffer overflowsPieter Wuille
There exists a per-message-processed send buffer overflow protection, where processing is halted when the send buffer is larger than the allowed maximum. This protection does not apply to individual items, however, and getdata has the potential for causing large amounts of data to be sent. In case several hundreds of blocks are requested in one getdata, the send buffer can easily grow 50 megabytes above the send buffer limit. This commit breaks up the processing of getdata requests, remembering them inside a CNode when too many are requested at once.
2013-03-29Use per-message send buffer, rather than per connectionPieter Wuille
2013-03-29Some fixes to CNetMessage processingPieter Wuille
* Change CNode::vRecvMsg to be a deque instead of a vector (less copying) * Make sure to acquire cs_vRecvMsg in CNode::CloseSocketDisconnect (as it may be called without that lock).
2013-03-29P2P: improve RX/TX flow controlJeff Garzik
1) "optimistic write": Push each message to kernel socket buffer immediately. 2) If there is write data at select time, that implies send() blocked during optimistic write. Drain write queue, before receiving any more messages. This avoids needlessly queueing received data, if the remote peer is not themselves receiving data. Result: write buffer (and thus memory usage) is kept small, DoS potential is slightly lower, and TCP flow control signalling is properly utilized. The kernel will queue data into the socket buffer, then signal the remote peer to stop sending data, until we resume reading again.
2013-03-29P2P: parse network datastream into header/data components in socket threadJeff Garzik
Replaces CNode::vRecv buffer with a vector of CNetMessage's. This simplifies ProcessMessages() and eliminates several redundant data copies. Overview: * socket thread now parses incoming message datastream into header/data components, as encapsulated by CNetMessage * socket thread adds each CNetMessage to a vector inside CNode * message thread (ProcessMessages) iterates through CNode's CNetMessage vector Message parsing is made more strict: * Socket is disconnected, if message larger than MAX_SIZE or if CMessageHeader deserialization fails (latter is impossible?). Previously, code would simply eat garbage data all day long. * Socket is disconnected, if we fail to find pchMessageStart. We do not search through garbage, to find pchMessageStart. Each message must begin precisely after the last message ends. ProcessMessages() always processes a complete message, and is more efficient: * buffer is always precisely sized, using CDataStream::resize(), rather than progressively sized in 64k chunks. More efficient for large messages like "block". * whole-buffer memory copy eliminated (vRecv -> vMsg) * other buffer-shifting memory copies eliminated (vRecv.insert, vRecv.erase)
2013-03-24(finally) Remove IRC Seed support now that lfnet is down.Matt Corallo
2013-01-27Use a copy in place of mapMultiArgs["-addnode"].Matt Corallo
Also moves the DNS lookup of -addnode nodes into the repeated loop, allowing -addnode to follow DNS changes.
2013-01-17Merge pull request #2060 from sipa/parallelGavin Andresen
Parallel script verification
2013-01-16Let a node opt out of tx invs before we get a their bloom filterMatt Corallo
Note that the default value for fRelayTxes is false, meaning we now no longer relay tx inv messages before receiving the remote peer's version message.
2013-01-16Replace RelayMessage with RelayTransaction.Matt Corallo
2013-01-16Add a filter field in CNode, add filterload+filteradd+filterclearMatt Corallo
2013-01-09Remove fClientPieter Wuille
Client (SPV) mode never got implemented entirely, and whatever part was already working, is likely not been tested (or even executed at all) for the past two years. This removes it entirely. If we want an SPV implementation, I think we should first get the block chain data structures to be encapsulated in a class implementing a standard interface, and then writing an alternate implementation with SPV semantics.
2013-01-08Parallelize script verificationPieter Wuille
* During block verification (when parallelism is requested), script check actions are stored instead of being executed immediately. * After every processed transactions, its signature actions are pushed to a CScriptCheckQueue, which maintains a queue and some synchronization mechanism. * Two or more threads (if enabled) start processing elements from this queue, * When the block connection code is finished processing transactions, it joins the worker pool until the queue is empty. As cs_main is held the entire time, and all verification must be finished before the block continues processing, this does not reach the best possible performance. It is a less drastic change than some more advanced mechanisms (like doing verification out-of-band entirely, and rolling back blocks when a failure is detected). The -par=N flag controls the number of threads (1-16). 0 means auto, and is the default.
2012-12-18Split off hash.h from util.hPieter Wuille
2012-12-12Merge pull request #2003 from alexanderkjeldaas/documented-locking-part-2Gavin Andresen
Documented locking part 1+2
2012-11-13Abstract block hash substr extraction (for debug.log) into BlockHashStr inlineLuke Dashjr
2012-11-11o Annotated lock-like functions in net.h.Alexander Kjeldaas
o Removed unused function EndMessageAbortIfEmpty
2012-10-25Merge pull request #1904 from laanwj/2012_10_remove_getorderPieter Wuille
remove "checkorder" P2P command
2012-10-20Move external block import to separate threadPieter Wuille
2012-10-03remove "checkorder" and "reply" P2P commandsWladimir J. van der Laan
These command are a leftover from send-to-IP transactions, which have been removed a long time ago. Also removes CNode::mapRequests and CNode::PushRequests, as these were only used for the mentioned commands.
2012-08-01Bugfix: Fix a variety of misspellingsLuke Dashjr
2012-08-01Merge pull request #1344 from rebroad/AskForTimeFormatJeff Garzik
Unless debugging, show a more useful format for the askfors
2012-07-04Fix remaining warnings.Matt Corallo
2012-07-02Include human readble format for nRequestTime.R E Broadley
2012-07-01Change default send buffer to 1Mb.Matt Corallo
2012-06-29RPC: add 'getpeerinfo', returning easy-to-retrieve per-CNode dataJeff Garzik
2012-06-27Stop processing messages on full send buffer and dont disconnect.Matt Corallo
Also decrease default send/receive buffer sizes from 10 to 5 mb as this patch makes it easy for a node to fill both instead of only send.
2012-06-23Merge pull request #1174 from sipa/torhsGregory Maxwell
Tor hidden service support
2012-06-23Add -tor and related configurationPieter Wuille
2012-06-22Introduce -debugnet option, thereby quieting some redundant debug messagesJeff Garzik
Prior to this change, each TX typically generated 3+ debug messages, askfor tx 8644cc97480ba1537214 0 sending getdata: tx 8644cc97480ba1537214 askfor tx 8644cc97480ba1537214 1339640761000000 askfor tx 8644cc97480ba1537214 1339640881000000 CTxMemPool::accept() : accepted 8644cc9748 (poolsz 6857) After this change, there is only one message for each valid TX received CTxMemPool::accept() : accepted 22a73c5d8c (poolsz 42) and two messages for each orphan tx received ERROR: FetchInputs() : 673dc195aa mempool Tx prev not found 1e439346fc stored orphan tx 673dc195aa (mapsz 19) The -debugnet option, or its superset -debug, will restore the full debug output.
2012-05-31Rework network config settingsPieter Wuille
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-16CAddrDB: Replace BDB-managed addr.dat with internally managed peers.datJeff Garzik