aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
Commit message (Collapse)AuthorAgeFilesLines
* add missing header end commentsPhilip Kaufmann2014-08-281-1/+1
| | | | | | - ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-1/+2
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* move functions in main and net to implementation filesWladimir J. van der Laan2014-08-261-150/+8
|
* Merge pull request #4605Wladimir J. van der Laan2014-08-181-0/+1
|\ | | | | | | | | | | | | aa82795 Add detailed network info to getnetworkinfo RPC (Wladimir J. van der Laan) 075cf49 Add GetNetworkName function (Wladimir J. van der Laan) c91a947 Add IsReachable(net) function (Wladimir J. van der Laan) 60dc8e4 Allow -onlynet=onion to be used (Wladimir J. van der Laan)
| * Add IsReachable(net) functionWladimir J. van der Laan2014-07-301-0/+1
| | | | | | | | | | Allows other parts of the program to query for reachable status of a network. Similar to IsLimited(net).
* | small net cleanupPhilip Kaufmann2014-08-081-4/+3
|/ | | | | | - add comment for disabling sigpipe - add closing comment in compat.h - remove redundant check in net.h
* Add missing FindNode prototype to net.hWladimir J. van der Laan2014-07-241-0/+1
| | | | Also make the argument a const std::string & instead of pass-by-value.
* Convert closesocket 'compat wrapper' to function in netbaseWladimir J. van der Laan2014-07-171-2/+1
| | | | | | | | | | | 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-1/+1
|\ | | | | | | | | | | 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)
| * move rand functions from util to new random.h/.cppPhilip Kaufmann2014-07-091-1/+1
| |
* | Introduce whitelisted peers.Pieter Wuille2014-07-091-1/+12
|/ | | | | | | | | | | | | | | | | | | | | | | 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-2/+7
|/
* ensure clean and consistent "namespace" usagePhilip Kaufmann2014-06-261-2/+1
| | | | | | - remove some missplaced ; - ensure end of a namespace is clearly visible - use same formatting when using namespace
* Merge pull request #4388Wladimir J. van der Laan2014-06-231-2/+0
|\ | | | | | | | | 3dc1464 add missing vhListenSocket.clear(); to CNetCleanup() (Philip Kaufmann) 2831a03 remove unused CNode::Cleanup() (Philip Kaufmann)
| * remove unused CNode::Cleanup()Philip Kaufmann2014-06-221-2/+0
| |
* | Code simplifications after CTransaction::GetHash() cachingPieter Wuille2014-06-221-2/+2
|/
* Merge pull request #2784Wladimir J. van der Laan2014-06-121-3/+10
|\ | | | | | | f1920e8 Ping automatically every 2 minutes (unconditionally) (Pieter Wuille)
| * Ping automatically every 2 minutes (unconditionally)Pieter Wuille2014-06-091-3/+10
| | | | | | | | | | | | ... 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).
* | Merge pull request #4227Wladimir J. van der Laan2014-06-111-2/+2
|\ \ | | | | | | | | | | | | 634bd61 convert an if into an else if in OpenNetworkConnection() (Philip Kaufmann) 5bd6c31 small cleanup of net (Philip Kaufmann)
| * | small cleanup of netPhilip Kaufmann2014-06-111-2/+2
| |/ | | | | | | | | | | | | | | - 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
* / [Qt] allow setting listen via GUIPhilip Kaufmann2014-06-111-0/+2
|/ | | | | | | | | | - add DEFAULT_LISTEN in net.h and use in the code (shared setting between core and GUI) Important: This makes it obvious, that we need to re-think the settings/options handling, as GUI settings are processed before any parameter-interaction (which is mostly important for network stuff) in AppInit2()!
* Merge pull request #3824Wladimir J. van der Laan2014-06-091-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f0a83fc Use Params().NetworkID() instead of TestNet() from the payment protocol (jtimon) 2871889 net.h was using std namespace through chainparams.h included in protocol.h (jtimon) c8c52de Replace virtual methods with static attributes, chainparams.h depends on protocol.h instead of the other way around (jtimon) a3d946e Get rid of TestNet() (jtimon) 6fc0fa6 Add RPCisTestNet chain parameter (jtimon) cfeb823 Add RequireStandard chain parameter (jtimon) 21913a9 Add AllowMinDifficultyBlocks chain parameter (jtimon) d754f34 Move majority constants to chainparams (jtimon) 8d26721 Get rid of RegTest() (jtimon) cb9bd83 Add DefaultCheckMemPool chain parameter (jtimon) 2595b9a Add DefaultMinerThreads chain parameter (jtimon) bfa9a1a Add MineBlocksOnDemand chain parameter (jtimon) 1712adb Add MiningRequiresPeers chain parameter (jtimon)
| * net.h was using std namespace through chainparams.h included in protocol.hjtimon2014-06-041-1/+1
| |
* | Merge pull request #4247 from Diapolo/listenJeff Garzik2014-06-041-0/+1
|\ \ | |/ |/| rename fNoListen to fListen and move to net
| * rename fNoListen to fListen and move to netPhilip Kaufmann2014-05-291-0/+1
| | | | | | | | | | - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI
* | Limit number of known addresses per peerPieter Wuille2014-05-301-2/+2
|/
* Merge pull request #4132Wladimir J. van der Laan2014-05-291-0/+6
|\ | | | | | | d4e1c61 add DEFAULT_UPNP constant in net (Philip Kaufmann)
| * add DEFAULT_UPNP constant in netPhilip Kaufmann2014-05-201-0/+6
| | | | | | | | | | - 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 #4206Wladimir J. van der Laan2014-05-251-1/+1
|\ \ | | | | | | | | | 79d06dc Remove redundant c_str (R E Broadley)
| * | Remove redundant c_strR E Broadley2014-05-221-1/+1
| |/
* / Fix addnode "onetry": Connect with OpenNetworkConnectionCozz Lovan2014-05-101-0/+1
|/
* rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan2014-05-061-0/+7
| | | | | | | | | | | | | 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)
* Merge pull request #3514Wladimir J. van der Laan2014-03-101-1/+1
|\ | | | | | | f59d8f0 Per-peer block download tracking and stalled download detection. (Pieter Wuille)
| * Per-peer block download tracking and stalled download detection.Pieter Wuille2014-02-081-1/+1
| | | | | | | | | | | | | | | | | | Keep track of which block is being requested (and to be requested) from each peer, and limit the number of blocks in-flight per peer. In addition, detect stalled downloads, and disconnect if they persist for too long. This means blocks are never requested twice, and should eliminate duplicate downloads during synchronization.
* | 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.
* | Don't use PRIx64 formatting derives from inttypes.hWladimir J. van der Laan2014-02-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | As the tinyformat-based formatting system (introduced in b77dfdc) is type-safe, no special format characters are needed to specify sizes. Tinyformat can support (ignore) the C99 prefixes such as "ll" but chokes on MSVC's inttypes.h defines prefixes such as "I64X". So don't include inttypes.h and define our own for compatibility. (an alternative would be to sweep the entire codebase using sed -i to get rid of the size specifiers but this has less diff impact)
* | 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.
* small headers ordering cleanupPhilip Kaufmann2014-01-111-2/+2
| | | | | | - keep headers in alphabetical order - fix Makefile.am (2 files in 1 line - leftover) - remove some spaces etc.
* Add main-specific node statePieter Wuille2013-12-081-5/+21
|
* Move CAddrDB frrom db to netWladimir J. van der Laan2013-12-041-0/+11
| | | | | | | | | 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-2/+6
|
* misc small changes to polish after include cleanupPhilip Kaufmann2013-11-111-1/+0
|
* Move CCoins-related logic to coins.{cpp.h}Pieter Wuille2013-11-101-1/+0
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-48/+59
| | | | | | | | | 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.
* Merge pull request #3155 from wtogami/split_proto_varWladimir J. van der Laan2013-11-081-2/+2
|\ | | | | Split MIN_PROTO_VERSION into INIT_PROTO_VERSION and MIN_PEER_PROTO_VERSION
| * Split MIN_PROTO_VERSION into INIT_PROTO_VERSION and MIN_PEER_PROTO_VERSIONWarren Togami2013-10-251-2/+2
| | | | | | | | | | INIT_PROTO_VERSION is the initial version, after a succesful version/verack it is increased to a negotiated version. MIN_PEER_PROTO_VERSION could be a different value to disconnect from peers older than a specified version.
* | -fuzzmessagestest=N : randomly corrupt 1-of-N sent messagesGavin Andresen2013-10-291-1/+9
|/ | | | | 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/+1
| | | | | | | 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.