aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * | 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
| |
* | do not use external IPv4 discovery, when -onlynet="IPv6"Philip Kaufmann2012-07-201-1/+3
| |
* | fix a comment in net.cppPhilip Kaufmann2012-07-171-1/+1
| |
* | Fix thread names after reviewGiel van Schijndel2012-07-171-3/+3
| | | | | | | | | | | | | | | | * Fix wrong thread name for wallet *relocking* thread - Was named the unlocking thread * Use consistent naming Signed-off-by: Giel van Schijndel <[email protected]>
* | Give threads a recognisable name to aid in debuggingGiel van Schijndel2012-07-171-0/+34
| | | | | | | | | | | | | | | | NOTE: These thread names are visible in gdb when using 'info threads'. Additionally both 'top' and 'ps' show these names *unless* told to display the command-line instead of task name. Signed-off-by: Giel van Schijndel <[email protected]>
* | Reorder dnsseed list, Jeff's seed list is static so put it last.Gregory Maxwell2012-07-111-2/+2
| | | | | | | | | | | | | | Because new nodes pull from the first connected node the load balancing of the first connection is more important than it should be. This change puts Pieter's seed first, because its probably the best maintained right now.
* | Merge pull request #1546 from gmaxwell/allowsamenetinboundJeff Garzik2012-07-031-3/+4
|\ \ | | | | | | Do not consider inbound peers for outbound network group exclusion.
| * | Do not consider inbound peers for outbound network group exclusion.Gregory Maxwell2012-07-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bitcoin will not make an outbound connection to a network group (/16 for IPv4) that it is already connected to. This means that if an attacker wants good odds of capturing all a nodes outbound connections he must have hosts on a a large number of distinct groups. Previously both inbound and outbound connections were used to feed this exclusion. The use of inbound connections, which can be controlled by the attacker, actually has the potential of making sibyl attacks _easier_: An attacker can start up hosts in groups which house many honest nodes and make outbound connections to the victim to exclude big swaths of honest nodes. Because the attacker chooses to make the outbound connection he can always beat out honest nodes for the consumption of inbound slots. At _best_ the old behavior increases attacker costs by a single group (e.g. one distinct group to use to fill up all your inbound slots), but at worst it allows the attacker to select whole networks you won't connect to. This commit makes the nodes use only outbound links to exclude network groups for outbound connections. Fancier things could be done, like weaker exclusion for inbound groups... but simplicity is good and I don't believe more complexity is currently needed.
* | | Remove useless high-volume printf (fixes #1544).Matt Corallo2012-07-011-2/+0
|/ /
* / RPC: add 'getpeerinfo', returning easy-to-retrieve per-CNode dataJeff Garzik2012-06-291-1/+17
|/