aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
Commit message (Collapse)AuthorAgeFilesLines
* apply bitcoin patch for miniupnpc 1.9acerix2015-10-121-1/+5
|
* Always use a 50% chance to choose between tried and new entriesPieter Wuille2015-06-271-2/+1
| | | | | | | | | | This change was suggested as Countermeasure 2 in Eclipse Attacks on Bitcoin’s Peer-to-Peer Network, Ethan Heilman, Alison Kendler, Aviv Zohar, Sharon Goldberg. ePrint Archive Report 2015/263. March 2015. Rebased-From: c6a63ceeb4956933588995bcf01dc3095aaeb1fc Github-Pull: #5941
* Limit message sizes before transferPieter Wuille2015-06-271-0/+5
| | | | | | | | This introduces a fixed limit for the size of p2p messages, and enforces it before download. Rebased-From: ba04c4a7801e7d68a5e84035b919e5c3626eb7a7 Github-Pull: #5843
* prevent SOCKET leak in BindListenPort()Philip Kaufmann2015-06-271-0/+2
| | | | | | - the call to CloseSocket() is placed after the WSAGetLastError(), because a CloseSocket() can trigger an error also, which we don't want for the logging in this two cases
* Convert closesocket 'compat wrapper' to function in netbaseWladimir J. van der Laan2015-06-271-10/+9
| | | | | | | | | | | Simpler alternative to #4348. The current setup with closesocket() is strange. It poses as a compatibility wrapper but adds functionality. Rename it and make it a documented utility function in netbase. Code movement only, zero effect on the functionality.
* Introduce whitelisted peers.Pieter Wuille2015-06-271-14/+46
| | | | | | | | | | | | | | | | | | | | | | | This adds a -whitelist option to specify subnet ranges from which peers that connect are whitelisted. In addition, there is a -whitebind option which works like -bind, except peers connecting to it are also whitelisted (allowing a separate listen port for trusted connections). Being whitelisted has two effects (for now): * They are immune to DoS disconnection/banning. * Transactions they broadcast (which are valid) are always relayed, even if they were already in the mempool. This means that a node can function as a gateway for a local network, and that rebroadcasts from the local network will work as expected. Whitelisting replaces the magic exemption localhost had for DoS disconnection (local addresses are still never banned, though), which implied hidden service connects (from a localhost Tor node) were incorrectly immune to DoS disconnection as well. This old behaviour is removed for that reason, but can be restored using -whitelist=127.0.0.1 or -whitelist=::1 can be specified. -whitebind is safer to use in case non-trusted localhost connections are expected (like hidden services).
* Use pong receive time rather than processing timePieter Wuille2015-06-271-0/+3
|
* add missing BOOST_FOREACH indentation in ThreadSocketHandler()Philip Kaufmann2015-06-271-40/+41
|
* small cleanup of #ifdefs in BindListenPort()Philip Kaufmann2015-06-271-8/+15
| | | | | | - SO_NOSIGPIPE isn't available on WIN32 so merge the 2 non-WIN32 blocks - use predefined names from header for IPV6_PROTECTION_LEVEL and PROTECTION_LEVEL_UNRESTRICTED
* add missing vhListenSocket.clear(); to CNetCleanup()Philip Kaufmann2015-06-271-0/+1
|
* remove unused CNode::Cleanup()Philip Kaufmann2015-06-271-6/+0
|
* Ping automatically every 2 minutes (unconditionally)Pieter Wuille2015-06-271-7/+11
| | | | | | ... instead of after 30 minutes of no sending, for latency measurement and keep-alive. Also, disconnect if no reply arrives within 20 minutes, instead of 90 of inactivity (for peers supporting the 'pong' message).
* rename fNoListen to fListen and move to netPhilip Kaufmann2015-06-271-1/+2
| | | | | - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI
* Introduce -maxoutconnections= to set the maximum number of outbound connectionslangerhans2014-12-201-5/+4
|
* remove useless millisleepphantomcircuit2014-09-181-2/+0
| | | | | | reduces time to service requests improving performance Rebased-From: 9189f5fe4df1ac7ea6ca75ceada867beafda90a9
* Avoid querying DNS seeds, if we have open connections.Jeff Garzik2014-08-281-0/+12
| | | | The goal is to increase independence and privacy.
* Don't poll showmyip.com, it doesn't exist anymoreWladimir J. van der Laan2014-08-281-20/+1
| | | | | | | | | Fixes #4679. This leaves us with only one candidate, checkip.dyndns.org. GetMyExternalIP should be phased out as soon as possible. Rebased-From: c33b983
* Use pnode->nLastRecv as sync score directlyHuang Le2014-07-091-6/+6
| | | | | | | | | | NodeSyncScore() should find the node which we recv data most recently, so put a negative sign to pnode->nLastRecv is indeed wrong. Also change the return value type to int64_t. Signed-off-by: Huang Le <[email protected]> Rebased-By: Wladimir J. van der Laan <[email protected]> Rebased-From: 09a54a6
* Replace non-threadsafe strerrorWladimir J. van der Laan2014-07-091-12/+12
| | | | | | | | | | Log the name of the error as well as the error code if a network problem happens. This makes network troubleshooting more convenient. Use thread-safe strerror_r and the WIN32 equivalent FormatMessage. Conflicts: src/netbase.cpp
* replace custom GetFilesize() with boost::filesystem::file_size()Philip Kaufmann2014-06-291-0/+2
|
* rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan2014-06-291-7/+2
| | | | | | | | | | | | | Adds two new info query commands that take over information from hodge-podge `getinfo`. Also some new information is added: - `getblockchaininfo` - `chain`: (string) current chain (main, testnet3, regtest) - `verificationprogress: (numeric) estimated verification progress - `chainwork` - `getnetworkinfo` - `localaddresses`: (array) local addresses, from mapLocalHost (fixes #1734)
* Better std exception logging for CAddrDbPhilip Kaufmann2014-06-291-11/+12
|
* Remove build-time no-IPv6 settingWladimir J. van der Laan2014-06-291-12/+0
| | | | | | | | | | | The year is 2014. All supported operating systems have IPv6 support, most certainly at build time (this doesn't mean that IPv6 is configured, of course). If noone is exercising the functionality to disable it, that means it doesn't get tested, and IMO it's better to get rid of it. (it's also not used consistently in RPC/boost and Net code...)
* Prevent socket leak in ThreadSocketHandler.Gregory Maxwell2014-05-261-5/+1
| | | | | | | | | | | | | | When we are over our outbound limit ThreadSocketHandler would try to keep the connection if the peer was addnoded. This didn't actually work for two reasons: It didn't actually run the accept code due to mistaken code flow, and because we have a limited number of outbound semaphores it couldn't actually use the connection. Instead it leaked the socket, which might have caused issue #4034. This patch just takes out the non-functioning white-listing for now.
* Replaced references to Bitcoin with Dogecoin/Dogecoin Core as appropriate.Ross Nicoll2014-03-281-2/+2
|
* Clarify the error message when unable to bind to portpaveljanik2014-03-051-2/+2
| | | | | | | | | | When bitcoind can't bind, bitcoin server (or Bitcoin Core Daemon) is probably already running. Add the missing word "server". Bitcoin itself is definitely running ;-) Add _(...) so the string can be localized. Rebased-From: 094eeff, 2d2d8fa
* Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan2014-02-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Amend to d5f1e72. It turns out that BerkelyDB was including inttypes.h indirectly, so we cannot fix this with just macros. Trivial commit: apply the following script to all .cpp and .h files: # Middle sed -i 's/"PRIx64"/x/g' "$1" sed -i 's/"PRIu64"/u/g' "$1" sed -i 's/"PRId64"/d/g' "$1" # Initial sed -i 's/PRIx64"/"x/g' "$1" sed -i 's/PRIu64"/"u/g' "$1" sed -i 's/PRId64"/"d/g' "$1" # Trailing sed -i 's/"PRIx64/x"/g' "$1" sed -i 's/"PRIu64/u"/g' "$1" sed -i 's/"PRId64/d"/g' "$1" After this commit, `git grep` for PRI.64 should turn up nothing except the defines in util.h.
* Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron2014-02-091-1/+1
| | | | | | in 2014. contrib/devtools/fix-copyright-headers.py script to be able to perform this maintenance task with ease during the rest of the year, every year. Modifications to contrib/devtools/README.md to document what fix-copyright-headers.py does.
* Remove redundant .c_str()sWladimir J. van der Laan2014-01-231-22/+22
| | | | | | | After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
* Make bitcoin compile without wallet if "db_cxx.h" is not presentThomas Holenstein2013-12-191-1/+0
| | | | | Moved includes of "db.h" into #ifdef ENABLE_WALLET blocks or remove them.
* Merge pull request #3373Wladimir J. van der Laan2013-12-091-3/+3
|\ | | | | | | 80ecf67 Add ThreadGetMyExternalIP to net thread group (Gavin Andresen)
| * Add ThreadGetMyExternalIP to net thread groupGavin Andresen2013-12-091-3/+3
| | | | | | | | Fixes #3372 -- crash at shutdown.
* | Add main-specific node statePieter Wuille2013-12-081-22/+10
|/
* Move CAddrDB frrom db to netWladimir J. van der Laan2013-12-041-0/+100
| | | | | | | | | 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.
* Store and use a sanitized subVerMike Hearn2013-11-261-1/+1
|
* Merge pull request #3257Wladimir J. van der Laan2013-11-201-3/+0
|\ | | | | | | 379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
| * core: remove includes in .cpp, if header is already in .hPhilip Kaufmann2013-11-151-3/+0
| | | | | | | | | | - example: if util.h includes stdint.h, remove it from util.cpp, as util.h is the first header included in util.cpp
* | orphan spaces cleanup ;-)Philip Kaufmann2013-11-151-7/+7
|/
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-30/+32
| | | | | | | | | 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.
* process received messages one at a time without sleeping between messagesPatrick Strateman2013-11-031-2/+16
|
* -fuzzmessagestest=N : randomly corrupt 1-of-N sent messagesGavin Andresen2013-10-291-0/+35
| | | | | I needed this to test the new "reject" p2p message, but it should be generally useful for fuzz-testing network message handling code.
* Adding new "addrlocal" field to RPC getpeerinfo.Josh Lehan2013-10-211-0/+3
| | | | | | | 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.
* Merge pull request #2840 from sipa/nosendlockGavin Andresen2013-10-201-1/+2
|\ | | | | Allow SendMessages to run partially without cs_main
| * Run node deletions outside of cs_vNodesPieter Wuille2013-10-151-1/+2
| |
* | Merge pull request #3119Pieter Wuille2013-10-201-1/+1
|\ \ | |/ |/| | | db0e8cc Bump Year Number to 2013 (super3)
| * Bump Year Number to 2013super32013-10-201-1/+1
| |
* | Merge pull request #2924 from sje397/TrafficGraphWladimir J. van der Laan2013-10-151-5/+32
|\ \ | | | | | | [QT] Add network traffic graph to debug window
| * | Add network traffic graphScott Ellis2013-10-141-5/+32
| | |
* | | Merge pull request #3077 from sipa/chainGavin Andresen2013-10-141-0/+4
|\ \ \ | |/ / |/| | Refactor/encapsulate chain globals into a CChain class
| * | Refactor/encapsulate chain globals into a CChain classPieter Wuille2013-10-111-0/+4
| |/