aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * Drop release times for CNodePieter Wuille2013-04-041-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | small indentation, space, formatting fixes (no code changes)Philip Kaufmann2013-04-061-14/+10
|/
* Merge pull request #2423 from TheBlueMatt/limitedmapalreadyaskedforGavin Andresen2013-04-031-1/+1
|\ | | | | Limited mapAlreadyAskedFor
| * Move mapAlreadyAskedFor to limitedmapMatt Corallo2013-04-011-1/+1
| | | | | | | | | | | | 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.
* | Clean up shutdown processGavin Andresen2013-04-031-25/+10
| |
* | Port Thread* methods to boost::thread_groupGavin Andresen2013-04-031-297/+57
| |
* | Rename util.h Sleep --> MilliSleepGavin Andresen2013-04-031-17/+17
| | | | | | | | | | | | | | | | 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.
* | Shutdown cleanup prep-workGavin Andresen2013-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #2420 from sipa/globcleanGavin Andresen2013-04-021-2/+15
|\ \ | | | | | | Global cleanups
| * | Clean up global datastructures at shutdown.Pieter Wuille2013-03-291-2/+15
| | | | | | | | | | | | This should make detecting leaks much easier.
* | | Move GenerateBitcoins() call out of net.cpp's StartNode()Jeff Garzik2013-03-311-3/+0
| |/ |/| | | | | | | The internal miner is closely bound to the wallet engine, not the blockchain engine.
* | Use per-message send buffer, rather than per connectionPieter Wuille2013-03-291-21/+38
| |
* | Some fixes to CNetMessage processingPieter Wuille2013-03-291-2/+9
| | | | | | | | | | | | * 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).
* | P2P: improve RX/TX flow controlJeff Garzik2013-03-291-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | P2P, cosmetic: break out buffer send(2) code into separate functionJeff Garzik2013-03-291-22/+25
| |
* | P2P: parse network datastream into header/data components in socket threadJeff Garzik2013-03-291-13/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Add a new testnet dnsseed (currently only static list, will update)Matt Corallo2013-03-241-0/+1
| |
* | (finally) Remove IRC Seed support now that lfnet is down.Matt Corallo2013-03-241-6/+0
|/
* Add DNS seed support for testnetPeter Todd2013-01-291-21/+26
|
* New seed nodes, from http://bitcoin.sipa.be/seeds.txtGavin Andresen2013-01-291-77/+75
|
* Try more than the first address for a DNS -addnode.Matt Corallo2013-01-271-2/+2
|
* Make ThreadOpenAddedConnections2 exit quicker if(GetNameProxy()).Matt Corallo2013-01-271-0/+2
|
* Use a copy in place of mapMultiArgs["-addnode"].Matt Corallo2013-01-271-18/+35
| | | | | Also moves the DNS lookup of -addnode nodes into the repeated loop, allowing -addnode to follow DNS changes.
* Let a node opt out of tx invs before we get a their bloom filterMatt Corallo2013-01-161-0/+2
| | | | | | 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.
* Automatically add any matching outputs to a filter during matching.Matt Corallo2013-01-161-1/+1
|
* Replace RelayMessage with RelayTransaction.Matt Corallo2013-01-161-0/+44
|
* Remove fClientPieter Wuille2013-01-091-2/+1
| | | | | | | | | | 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.
* Merge pull request #1932 from Diapolo/thread_printfWladimir J. van der Laan2012-10-301-0/+2
|\ | | | | fix some thread related log messages
| * fix some thread related log messagesPhilip Kaufmann2012-10-251-0/+2
| | | | | | | | | | | | | | | | | | - "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
* | Merge pull request #1904 from laanwj/2012_10_remove_getorderPieter Wuille2012-10-251-7/+3
|\ \ | |/ |/| remove "checkorder" P2P command
| * remove "checkorder" and "reply" P2P commandsWladimir J. van der Laan2012-10-031-7/+3
| | | | | | | | | | | | | | 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.
* | Merge pull request #1901 from laanwj/2012_10_remove_strlcpyWladimir J. van der Laan2012-10-111-1/+0
|\ \ | | | | | | get rid of strlcpy.h
| * | get rid of strlcpy.hWladimir J. van der Laan2012-10-071-1/+0
| |/ | | | | | | | | Don't use hand-rolled string manipulation routine with a fixed buffer in the bitcoin core, instead make use of c++ strings and boost.
* / add LOCK() for proxy related data-structuresPhilip Kaufmann2012-10-041-2/+2
|/ | | | | | | | | - fix #1560 by properly locking proxy related data-structures - update GetProxy() and introduce GetNameProxy() to be able to use a thread-safe local copy from proxyInfo and nameproxyInfo - update usage of GetProxy() all over the source to match the new behaviour, as it now fills a full proxyType object - rename GetNameProxy() into HaveNameProxy() to be more clear
* fix -Wformat warnings all over the sourcePhilip Kaufmann2012-10-011-1/+1
|
* Remove stack randomizationPieter Wuille2012-09-281-14/+0
|
* fix signed/unsigned in strprintf and CNetAddr::GetByte()Philip Kaufmann2012-09-121-1/+1
| | | | | | - I checked every occurance of strprintf() in the code and used %u, where unsigned vars are used - the change to GetByte() was made, as ip is an unsigned char
* Merge pull request #1786 from jgarzik/select-fixWladimir J. van der Laan2012-09-061-3/+7
|\ | | | | select()'s first argument should be zero, if no file descriptors are selected
| * select(): Use precise fd presence check, rather than imprecise hSocketMax testJeff Garzik2012-09-051-3/+7
| |
* | replace 2x WSAGetLastError() with 1x WSAGetLastError() callPhilip Kaufmann2012-09-051-2/+3
|/
* Merge pull request #1777 from laanwj/2012_09_eliminate_sprintfJeff Garzik2012-09-041-10/+8
|\ | | | | Remove last occurrence of potentially insecure function sprintf
| * Remove last occurrence of potentially insecure function sprintf.Wladimir J. van der Laan2012-09-031-10/+8
| | | | | | | | | | %d can return up to 11 characters. Move away from fixed buffer completely and use our own safe function strprintf.
* | Rename CreateThread to NewThreadWladimir J. van der Laan2012-08-291-16/+16
|/ | | | Prevent clash with win32 API symbol
* Bugfix: increase score, not portPieter Wuille2012-08-291-2/+2
|
* Fix infinite loops in connection logicPieter Wuille2012-08-221-1/+7
|
* Merge pull request #1632 from luke-jr/spellingJeff Garzik2012-08-011-7/+7
|\ | | | | Fix spelling and grammar errors
| * Bugfix: Fix a variety of misspellingsLuke Dashjr2012-08-011-7/+7
| |
* | Update Warning-strings to use a standard-formatPhilip Kaufmann2012-08-011-2/+2
|/ | | | | | | | | - ensure warnings always start with "Warning:" and that the first character after ":" is written uppercase - ensure the first sentence in warnings ends with an "!" - remove unneeded spaces from Warning-strings - add missing Warning-string translation - remove a "\n" and replace with untranslatable "<br><br>"
* Merge pull request #1343 from rebroad/MisbehavingDeltaJeff Garzik2012-08-011-3/+4
|\ | | | | Show when node is misbehaving, not just at the point that it gets banned...
| * Show when node is misbehaving, not just at the point that it gets banned.R E Broadley2012-07-021-3/+4
| |