aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
AgeCommit message (Collapse)Author
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.
2013-03-24Add a new testnet dnsseed (currently only static list, will update)Matt Corallo
2013-03-24(finally) Remove IRC Seed support now that lfnet is down.Matt Corallo
2013-01-29Add DNS seed support for testnetPeter Todd
2013-01-29New seed nodes, from http://bitcoin.sipa.be/seeds.txtGavin Andresen
2013-01-27Try more than the first address for a DNS -addnode.Matt Corallo
2013-01-27Make ThreadOpenAddedConnections2 exit quicker if(GetNameProxy()).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-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-16Automatically add any matching outputs to a filter during matching.Matt Corallo
2013-01-16Replace RelayMessage with RelayTransaction.Matt 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.
2012-10-30Merge pull request #1932 from Diapolo/thread_printfWladimir J. van der Laan
fix some thread related log messages
2012-10-25Merge pull request #1904 from laanwj/2012_10_remove_getorderPieter Wuille
remove "checkorder" P2P command
2012-10-25fix some thread related log messagesPhilip Kaufmann
- "ThreadIRCSeed started" was not displayed, even if the thread ran (although only for a short time as the "do we want this thread?"-checks happen IN ThreadIRCSeed2()) - the patch ensures we always get that message - add a "ThreadIRCSeed trying to connect..." message - add missing "ThreadDumpAddress started" message
2012-10-11Merge pull request #1901 from laanwj/2012_10_remove_strlcpyWladimir J. van der Laan
get rid of strlcpy.h