aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* ignore-proxy-connection-errorDemon2021-02-231-18/+34
|
* Merge #9289: net: drop boost::thread_groupWladimir J. van der Laan2017-01-041-9/+10
|\ | | | | | | | | | | | | | | | | | | 67ee4ec net: misc header cleanups (Cory Fields) 8b3159e net: make proxy receives interruptible (Cory Fields) 5cb0fce net: remove thread_interrupted catch (Cory Fields) d3d7056 net: make net processing interruptible (Cory Fields) 0985052 net: make net interruptible (Cory Fields) 799df91 net: add CThreadInterrupt and InterruptibleSleep (Cory Fields) 7325b15 net: a few small cleanups before replacing boost threads (Cory Fields)
| * net: misc header cleanupsCory Fields2017-01-031-7/+0
| |
| * net: make proxy receives interruptibleCory Fields2017-01-031-2/+10
| |
* | Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
|/ | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Refactor: Removed begin/end_ptr functions.Karl-Johan Alm2016-12-091-3/+3
|
* Revert "Use async name resolving to improve net thread responsiveness"Matt Corallo2016-12-011-47/+1
| | | | | | | | | | This reverts commit caf6150e9785da408f1e603ae70eae25b5202d98. getaddrinfo_a has a nasty tendency to segfault internally in its background thread, on every version of glibc I tested, especially under helgrind. See https://sourceware.org/bugzilla/show_bug.cgi?id=20874
* Kill insecure_random and associated global stateWladimir J. van der Laan2016-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are only a few uses of `insecure_random` outside the tests. This PR replaces uses of insecure_random (and its accompanying global state) in the core code with an FastRandomContext that is automatically seeded on creation. This is meant to be used for inner loops. The FastRandomContext can be in the outer scope, or the class itself, then rand32() is used inside the loop. Useful e.g. for pushing addresses in CNode or the fee rounding, or randomization for coin selection. As a context is created per purpose, thus it gets rid of cross-thread unprotected shared usage of a single set of globals, this should also get rid of the potential race conditions. - I'd say TxMempool::check is not called enough to warrant using a special fast random context, this is switched to GetRand() (open for discussion...) - The use of `insecure_rand` in ConnectThroughProxy has been replaced by an atomic integer counter. The only goal here is to have a different credentials pair for each connection to go on a different Tor circuit, it does not need to be random nor unpredictable. - To avoid having a FastRandomContext on every CNode, the context is passed into PushAddress as appropriate. There remains an insecure_random for test usage in `test_random.h`.
* Do not shadow variables in networking codePavel Janík2016-08-151-3/+3
|
* net: Have LookupNumeric return a CService directlyCory Fields2016-08-041-2/+7
| | | | | | Also fix up a few small issues: - Lookup with "badip:port" now sets the port to 0 - Don't allow assert to have side-effects
* net: move CNetAddr/CService/CSubNet out of netbaseCory Fields2016-07-311-705/+0
|
* net: Split resolving out of CSubNetCory Fields2016-07-311-36/+58
|
* net: Split resolving out of CServiceCory Fields2016-07-311-33/+1
|
* net: Split resolving out of CNetAddrCory Fields2016-07-311-16/+10
|
* Randomize name lookup result in ConnectSocketByNamePieter Wuille2016-06-131-4/+4
|
* Use Socks5ErrorString() to decode error responses from socks proxy.Warren Togami2016-05-191-12/+16
|
* Make Socks5() InterruptibleRecv() timeout/failures informative.Warren Togami2016-05-171-1/+2
| | | | | | | | Before: 2016-05-16 06:10:45 ERROR: Error reading proxy response After: 2016-05-16 06:10:45 Socks5() connect to k7s5d6jqig4ej4v4.onion:18333 failed: InterruptibleRecv() timeout or other failure
* SOCKS5 connecting and connected messages with -debug=net.Warren Togami2016-05-091-2/+2
| | | | They were too noisy and not necessary for normal operation.
* Make failures to connect via Socks5() more informative and less ↵Warren Togami2016-05-091-9/+11
| | | | | | | | | | | | | unnecessarily scary. * The "ERROR" was printed far too often during normal operation for what was not an error. * Makes the Socks5() connect failure similar to the IP connect failure in debug.log. Before: `2016-05-09 00:15:00 ERROR: Proxy error: host unreachable` After: `2016-05-09 00:15:00 Socks5() connect to t6xj6wilh4ytvcs7.onion:18333 failed: host unreachable"`
* net: disable resolving from storage structuresCory Fields2016-04-201-14/+14
| | | | CNetAddr/CService/CSubnet can no longer resolve DNS.
* net: resolve outside of storage structuresCory Fields2016-04-201-4/+6
| | | | | | | | Rather than allowing CNetAddr/CService/CSubNet to launch DNS queries, require that addresses are already resolved. This greatly simplifies async resolve logic, and makes it harder to accidentally leak DNS queries.
* Net: Add IPv6 Link-Local Address Supportmruddy2016-04-051-3/+7
|
* Typo fixes in commentsChris Wheeler2016-01-171-1/+1
|
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* [trivial] Reuse translation and cleanup DEFAULT_* valuesMarcoFalke2015-11-281-1/+1
| | | | | * DEFAULT_DISABLE_SAFEMODE = false * Use DEFAULT_* constants for extern bools
* Constrain constant values to a single location in codeLuke Dashjr2015-11-281-1/+1
|
* net: Automatically create hidden service, listen on TorWladimir J. van der Laan2015-11-101-4/+1
| | | | | | | | | | | | | | | | | | | | Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket API, to create and destroy 'ephemeral' hidden services programmatically. https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service This means that if Tor is running (and proper authorization is available), bitcoin automatically creates a hidden service to listen on, without user manual configuration. This will positively affect the number of available .onion nodes. - When the node is started, connect to Tor through control socket - Send `ADD_ONION` command - First time: - Make it create a hidden service key - Save the key in the data directory for later usage - Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on). - Keep control socket connection open for as long node is running. The hidden service will (by default) automatically go away when the connection is closed.
* Set TCP_NODELAY on P2P sockets.Gregory Maxwell2015-10-221-1/+8
| | | | | | | | Nagle appears to be a significant contributor to latency now that the static sleeps are gone. Most of our messages are relatively large compared to IP + TCP so I do not expect this to create enormous overhead. This may also reduce traffic burstyness somewhat.
* net: Fix CIDR notation in ToString()Wladimir J. van der Laan2015-09-161-10/+48
| | | | Only use CIDR notation if the netmask can be represented as such.
* net: use CIDR notation in CSubNet::ToString()Jonas Schnelli2015-09-161-9/+11
|
* Merge pull request #6556Wladimir J. van der Laan2015-08-201-1/+1
|\ | | | | | | | | 1123cdb add unit test for CNetAddr::GetGroup. (Alex Morcos) bba3db1 Fix masking of irrelevant bits in address groups. (Alex Morcos)
| * Fix masking of irrelevant bits in address groups.Alex Morcos2015-08-141-1/+1
| |
* | typofixes (found by misspell_fixer)Veres Lajos2015-08-101-1/+1
|/
* Test whether created sockets are select()ablePieter Wuille2015-07-101-0/+3
|
* Adding CSubNet constructor over a single CNetAddrJonas Schnelli2015-07-021-0/+7
|
* fix CSubNet comparison operatorJonas Schnelli2015-06-171-1/+1
|
* [RPC] extend setban to allow subnetsJonas Schnelli2015-06-171-0/+5
|
* [net, trivial] remove using namespace std pollution in netbase.cppPhilip Kaufmann2015-05-311-4/+2
|
* Fix two problems in CSubNet parsingWladimir J. van der Laan2015-05-261-1/+5
| | | | | | | | | | | | | | | Fix two CSubNet constructor problems: - The use of `/x` where 8 does not divide x was broken, due to a bit-order issue - The use of e.g. `1.2.3.4/24` where the netmasked bits in the network are not 0 was broken. Fix this by explicitly normalizing the netwok according to the bitmask. Also add tests for these cases. Fixes #6179. Thanks to @jonasschnelli for reporting and initial fix.
* Simplify code for CSubnetWladimir J. van der Laan2015-05-261-8/+6
| | | | | Simplify the code by using CAddress.ip directly, instead of the reversed GetByte() semantics.
* use const reference as param in ConnectThroughProxy/Socks5Philip Kaufmann2015-04-281-2/+2
| | | | - also ensure code style conformance by replacing bool static with static bool
* privacy: Stream isolation for TorWladimir J. van der Laan2015-04-171-66/+104
| | | | | | | | | | | | | According to Tor's extensions to the SOCKS protocol (https://gitweb.torproject.org/torspec.git/tree/socks-extensions.txt) it is possible to perform stream isolation by providing authentication to the proxy. Each set of credentials will create a new circuit, which makes it harder to correlate connections. This patch adds an option, `-proxyrandomize` (on by default) that randomizes credentials for every outgoing connection, thus creating a new circuit. 2015-03-16 15:29:59 SOCKS5 Sending proxy authentication 3842137544:3256031132
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Regard connection failures as attempt for addrmanWladimir J. van der Laan2014-12-021-4/+16
| | | | | | | This avoids connecting to them again too soon in ThreadOpenConnections. Make an exception for connection failures to the proxy as these shouldn't affect the status of specific nodes.
* Use complete path to include bitcoin-config.h.Pavel Janík2014-11-261-1/+1
|
* Add missing reserved address spaces.Matt Corallo2014-10-281-1/+18
|
* add -timeout default as constant and use themPhilip Kaufmann2014-10-061-1/+1
| | | | | - update help message text - simplify code in init to check for -timeout
* netbase: Make SOCKS5 negotiation interruptibleWladimir J. van der Laan2014-09-101-18/+70
| | | | | | | | | | | | Avoids that SOCKS5 negotiation will hold up the shutdown process. - Sockets can stay in non-blocking mode, no need to switch it on/off anymore - Adds a timeout (20 seconds) on SOCK5 negotiation. This should be enough for even Tor to get a connection to a hidden service, and avoids blocking the opencon thread indefinitely on a hanging proxy. Fixes #2954.
* netbase: Use .data() instead of .c_str() on binary stringWladimir J. van der Laan2014-09-081-1/+1
| | | | | `.c_str()` is only guaranteed to return the data up to the first NUL character.