aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
AgeCommit message (Collapse)Author
2013-12-08Add main-specific node statePieter Wuille
2013-12-04Move CAddrDB frrom db to netWladimir J. van der Laan
This was a leftover from the times in which peers.dat depended in BDB. Other functions in db.cpp still depend on BerkelyDB, to be able to compile without BDB this (small) functionality needs to be moved to another file.
2013-11-26Store and use a sanitized subVerMike Hearn
2013-11-11misc small changes to polish after include cleanupPhilip Kaufmann
2013-11-10Move CCoins-related logic to coins.{cpp.h}Pieter Wuille
2013-11-10Cleanup code using forward declarations.Brandon Dahler
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
2013-11-08Merge pull request #3155 from wtogami/split_proto_varWladimir J. van der Laan
Split MIN_PROTO_VERSION into INIT_PROTO_VERSION and MIN_PEER_PROTO_VERSION
2013-10-29-fuzzmessagestest=N : randomly corrupt 1-of-N sent messagesGavin Andresen
I needed this to test the new "reject" p2p message, but it should be generally useful for fuzz-testing network message handling code.
2013-10-25Split MIN_PROTO_VERSION into INIT_PROTO_VERSION and MIN_PEER_PROTO_VERSIONWarren Togami
INIT_PROTO_VERSION is the initial version, after a succesful version/verack it is increased to a negotiated version. MIN_PEER_PROTO_VERSION could be a different value to disconnect from peers older than a specified version.
2013-10-21Adding new "addrlocal" field to RPC getpeerinfo.Josh Lehan
The existing CNode::addrLocal member is revealed to the user, as an address string, similar to the existing "addr" field. Instead of showing garbage or empty string, it simply will not appear in the output if local address not known yet.
2013-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3
2013-10-15Merge pull request #2924 from sje397/TrafficGraphWladimir J. van der Laan
[QT] Add network traffic graph to debug window
2013-10-15misc spelling / space / style fixesPhilip Kaufmann
2013-10-14Merge pull request #3077 from sipa/chainGavin Andresen
Refactor/encapsulate chain globals into a CChain class
2013-10-14Add network traffic graphScott Ellis
2013-10-11Refactor/encapsulate chain globals into a CChain classPieter Wuille
2013-10-04Added ping time measurement.Josh Lehan
New RPC "ping" command to request ping. Implemented "pong" message handler. New "pingtime" field in getpeerinfo, to provide results to user. New "pingwait" field, to show pings still in flight, to better see newly lagging peers.
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