aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #4491Wladimir J. van der Laan2014-07-281-15/+4
|\ | | | | | | eaedb59 net: add SetSocketNonBlocking() as OS independent wrapper (Philip Kaufmann)
| * net: add SetSocketNonBlocking() as OS independent wrapperPhilip Kaufmann2014-07-171-15/+4
| |
* | Merge pull request #4584Wladimir J. van der Laan2014-07-251-1/+1
|\ \ | | | | | | | | | 0430c30 Add missing FindNode prototype to net.h (Wladimir J. van der Laan)
| * | Add missing FindNode prototype to net.hWladimir J. van der Laan2014-07-241-1/+1
| | | | | | | | | | | | Also make the argument a const std::string & instead of pass-by-value.
* | | remove an unneded .c_str() in OpenNetworkConnection()Philip Kaufmann2014-07-211-1/+1
|/ /
* / prevent SOCKET leak in BindListenPort()Philip Kaufmann2014-07-171-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 Laan2014-07-171-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.
* Merge pull request #4400Wladimir J. van der Laan2014-07-141-2/+2
|\ | | | | | | | | | | 4eedf4f make RandAddSeed() use OPENSSL_cleanse() (Philip Kaufmann) 6354935 move rand functions from util to new random.h/.cpp (Philip Kaufmann) 001a53d add GetRandBytes() as wrapper for RAND_bytes() (Philip Kaufmann)
| * add GetRandBytes() as wrapper for RAND_bytes()Philip Kaufmann2014-07-091-2/+2
| | | | | | | | | | | | - add a small wrapper in util around RAND_bytes() and replace with GetRandBytes() in the code to log errors from calling RAND_bytes() - remove OpenSSL header rand.h where no longer needed
* | Introduce whitelisted peers.Pieter Wuille2014-07-091-15/+45
|/ | | | | | | | | | | | | | | | | | | | | | | 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).
* Merge pull request #4472Wladimir J. van der Laan2014-07-071-0/+3
|\ | | | | | | 9f4da19 Use pong receive time rather than processing time (Pieter Wuille)
| * Use pong receive time rather than processing timePieter Wuille2014-07-061-0/+3
| |
* | Show nodeid instead of addresses (for anonymity) unless otherwise requested.R E Broadley2014-07-041-6/+7
|/
* add missing BOOST_FOREACH indentation in ThreadSocketHandler()Philip Kaufmann2014-06-261-40/+41
|
* small cleanup of #ifdefs in BindListenPort()Philip Kaufmann2014-06-261-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
* build: fix build weirdness after 54372482.Cory Fields2014-06-231-1/+1
| | | | | | | | | | | | | bitcoin-config.h moved, but the old file is likely to still exist when reconfiguring or switching branches. This would've caused files to not rebuild correctly, and other strange problems. Make the path explicit so that the old one cannot be found. Core libs use config/bitcoin-config.h. Libs (like crypto) which don't want access to bitcoin's headers continue to use -Iconfig and #include bitcoin-config.h.
* Merge pull request #4388Wladimir J. van der Laan2014-06-231-5/+1
|\ | | | | | | | | 3dc1464 add missing vhListenSocket.clear(); to CNetCleanup() (Philip Kaufmann) 2831a03 remove unused CNode::Cleanup() (Philip Kaufmann)
| * add missing vhListenSocket.clear(); to CNetCleanup()Philip Kaufmann2014-06-221-0/+1
| |
| * remove unused CNode::Cleanup()Philip Kaufmann2014-06-221-5/+0
| |
* | Merge pull request #4309Pieter Wuille2014-06-221-5/+5
|\ \ | | | | | | | | | | | | d38da59 Code simplifications after CTransaction::GetHash() caching (Pieter Wuille) 4949004 Add CMutableTransaction and make CTransaction immutable. (Pieter Wuille)
| * | Code simplifications after CTransaction::GetHash() cachingPieter Wuille2014-06-221-5/+5
| |/
* / Allocate receive buffers in on the flyPieter Wuille2014-06-211-1/+5
|/
* Merge pull request #2784Wladimir J. van der Laan2014-06-121-7/+11
|\ | | | | | | f1920e8 Ping automatically every 2 minutes (unconditionally) (Pieter Wuille)
| * Ping automatically every 2 minutes (unconditionally)Pieter Wuille2014-06-091-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).
* | convert an if into an else if in OpenNetworkConnection()Philip Kaufmann2014-06-111-2/+1
| |
* | small cleanup of netPhilip Kaufmann2014-06-111-15/+11
|/ | | | | | | | - remove an unneded else in ConnectNode() - make 0 a double and change to 0.0 in ConnectNode() - rename strDest to pszDest in OpenNetworkConnection() - remove an unneded call to our REF() macro in BindListenPort() - small style cleanups and removal of unneeded new-lines
* Merge pull request #4247 from Diapolo/listenJeff Garzik2014-06-041-1/+2
|\ | | | | rename fNoListen to fListen and move to net
| * rename fNoListen to fListen and move to netPhilip Kaufmann2014-05-291-1/+2
| | | | | | | | | | - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI
* | Use pnode->nLastRecv as sync score directlyHuang Le2014-05-301-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]>
* Merge pull request #4132Wladimir J. van der Laan2014-05-291-3/+1
|\ | | | | | | d4e1c61 add DEFAULT_UPNP constant in net (Philip Kaufmann)
| * add DEFAULT_UPNP constant in netPhilip Kaufmann2014-05-201-3/+1
| | | | | | | | | | - as this is a shared Core/GUI setting, this makes it easier to keep them in sync (also no new includes are needed)
* | Merge pull request #4152Wladimir J. van der Laan2014-05-231-12/+12
|\ \ | | | | | | | | | | | | 3e8ac6a Replace non-threadsafe gmtime and setlocale (Wladimir J. van der Laan) a60838d Replace non-threadsafe strerror (Wladimir J. van der Laan)
| * | Replace non-threadsafe strerrorWladimir J. van der Laan2014-05-231-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.
* / Fix addnode "onetry": Connect with OpenNetworkConnectionCozz Lovan2014-05-101-3/+0
|/
* rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan2014-05-061-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-05-021-9/+10
| | | | - also small logging text changes
* Remove build-time no-IPv6 settingWladimir J. van der Laan2014-05-011-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-04-091-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.
* Merge pull request #3603Wladimir J. van der Laan2014-03-271-2/+4
|\ | | | | | | a486abd replace custom GetFilesize() with boost::filesystem::file_size() (Philip Kaufmann)
| * replace custom GetFilesize() with boost::filesystem::file_size()Philip Kaufmann2014-03-031-2/+4
| |
* | Slightly tweak error when unable to bind portMichagogo2014-03-051-1/+1
| | | | | | A slight improvement over 2d2d8fae3d8bc4e82dc631d93c6e19f954bbee04 -- we don't know that it's the daemon, it could be the GUI.
* | Clarify the error message when unable to bind to portpaveljanik2014-03-051-1/+1
| |
* | Bitcoin is running fine...paveljanik2014-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. I apologize for such trivial changes, learning github interface.
* 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
|/