aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
AgeCommit message (Collapse)Author
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-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 #2840 from sipa/nosendlockGavin Andresen
Allow SendMessages to run partially without cs_main
2013-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3
2013-10-15Run node deletions outside of cs_vNodesPieter Wuille
2013-10-15Merge pull request #2924 from sje397/TrafficGraphWladimir J. van der Laan
[QT] Add network traffic graph to debug window
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-09-05autotools: switch to autotools buildsystemCory Fields
2013-08-24Merge pull request #2618 from fcicq/solaris-supportJeff Garzik
Partial solaris support
2013-07-31Remove #define loop from util.hGavin Andresen
Replace the loop macro with while (true). The #define caused problems for Qt.
2013-07-17Fix fcntl include in net.cpp & netbase.cppfcicq
2013-07-13fix invalid conversion error with MinGW 4.8.1 in net.cppPhilip Kaufmann
- fixes src\net.cpp:1601: Error:invalid conversion from 'void*' to 'const char*' [-fpermissive] in a setsockopt() call on Win32 that was found by using MinGW 4.8.1 compiler suite
2013-06-24Dump addresses every 15 minutes instead of 10 secondsPieter Wuille
2013-06-19Introduce a CChainParameters singleton class and regtest mode.Mike Hearn
The new class is accessed via the Params() method and holds most things that vary between main, test and regtest networks. The regtest mode has two purposes, one is to run the bitcoind/bitcoinj comparison tool which compares two separate implementations of the Bitcoin protocol looking for divergence. The other is that when run, you get a local node which can mine a single block instantly, which is highly convenient for testing apps during development as there's no need to wait 10 minutes for a block on the testnet.
2013-06-11send tx relay flag with versionbitsofproof
2013-06-10changes to thread code (directly use boost::thread)Philip Kaufmann
- removes our NewThread() function an replaces remaining calls with boost::thread with our TraceThread template - remove ExitThread() function - fix THREAD_PRIORITY_ABOVE_NORMAL for non Windows OSes
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 unrelated-to-network calls in StartNode and StopNode into init.cppEric Lombrozo
2013-06-05Moved PushGetBlocks to main.cpp to eliminate dependence of net.cpp on ↵Eric Lombrozo
CBlockLocator.
2013-05-01Do not kill connections on recv buffer overflowPieter Wuille
Instead of killing a connection when the receive buffer overflows, just temporarily halt receiving before that happens. Also, no matter what, always allow at least one full message in the receive buffer (otherwise blocks larger than the configured buffer size would pause indefinitely).
2013-04-29Try to increase file descriptor rlimit if necessaryPieter Wuille
As the default can be too low, especially on OSX.
2013-04-28move WSAStartup to initWladimir J. van der Laan
WSAStartup should be called before using any other socket functions. BindListenPort is not called if not listening. Closes #2585.
2013-04-09Merge pull request #2461 from sipa/syncnodeGavin Andresen
Make sure we always have a node to do IBD from
2013-04-08net.cpp: Do not change primary process name from (default) to "bitcoin-start"Jeff Garzik
Discussed a bit on IRC.
2013-04-08Merge pull request #2419 from sipa/noreltimePieter Wuille
Drop release times for CNode
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-06small indentation, space, formatting fixes (no code changes)Philip Kaufmann
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-03Rename util.h Sleep --> MilliSleepGavin Andresen
Two reasons for this change: 1. Need to always use boost::thread's sleep, even on Windows, so the sleeps can be interrupted (prior code used Windows' built-in Sleep). 2. I always forgot what units the old Sleep took.
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-02Merge pull request #2420 from sipa/globcleanGavin Andresen
Global cleanups
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-31Move GenerateBitcoins() call out of net.cpp's StartNode()Jeff Garzik
The internal miner is closely bound to the wallet engine, not the blockchain engine.
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, cosmetic: break out buffer send(2) code into separate functionJeff Garzik
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-29Clean up global datastructures at shutdown.Pieter Wuille
This should make detecting leaks much easier.