aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
AgeCommit message (Collapse)Author
2014-06-02Use pnode->nLastRecv as sync score directlyHuang Le
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 <4tarhl@gmail.com> Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com> Rebased-From: 09a54a6
2014-05-23Replace non-threadsafe strerrorWladimir J. van der Laan
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 Rebased-By: Wladimir van der Laan <laanwj@gmail.com> Rebased-From: a60838d
2014-05-06rpc: add `getblockchaininfo` and `getnetworkinfo`Wladimir J. van der Laan
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)
2014-05-02better std::exception logging for CAddrDbPhilip Kaufmann
- also small logging text changes
2014-05-01Remove build-time no-IPv6 settingWladimir J. van der Laan
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...)
2014-04-09Prevent socket leak in ThreadSocketHandler.Gregory Maxwell
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.
2014-03-27Merge pull request #3603Wladimir J. van der Laan
a486abd replace custom GetFilesize() with boost::filesystem::file_size() (Philip Kaufmann)
2014-03-05Slightly tweak error when unable to bind portMichagogo
A slight improvement over 2d2d8fae3d8bc4e82dc631d93c6e19f954bbee04 -- we don't know that it's the daemon, it could be the GUI.
2014-03-05Clarify the error message when unable to bind to portpaveljanik
2014-03-05Bitcoin is running fine...paveljanik
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.
2014-03-03replace custom GetFilesize() with boost::filesystem::file_size()Philip Kaufmann
2014-02-24Get rid of C99 PRI?64 usage in source filesWladimir J. van der Laan
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.
2014-02-09Copyright header updates s/2013/2014 on files whose last git commit was done ↵gubatron
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.
2014-01-23Remove redundant .c_str()sWladimir J. van der Laan
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.
2013-12-19Make bitcoin compile without wallet if "db_cxx.h" is not presentThomas Holenstein
Moved includes of "db.h" into #ifdef ENABLE_WALLET blocks or remove them.
2013-12-09Merge pull request #3373Wladimir J. van der Laan
80ecf67 Add ThreadGetMyExternalIP to net thread group (Gavin Andresen)
2013-12-09Add ThreadGetMyExternalIP to net thread groupGavin Andresen
Fixes #3372 -- crash at shutdown.
2013-12-08Add main-specific node statePieter Wuille
2013-12-04Move CAddrDB frrom db to netWladimir J. van der Laan
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.
2013-11-26Store and use a sanitized subVerMike Hearn
2013-11-20Merge pull request #3257Wladimir J. van der Laan
379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
2013-11-15orphan spaces cleanup ;-)Philip Kaufmann
2013-11-15core: remove includes in .cpp, if header is already in .hPhilip Kaufmann
- example: if util.h includes stdint.h, remove it from util.cpp, as util.h is the first header included in util.cpp
2013-11-10Cleanup code using forward declarations.Brandon Dahler
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.
2013-11-03process received messages one at a time without sleeping between messagesPatrick Strateman
2013-10-29-fuzzmessagestest=N : randomly corrupt 1-of-N sent messagesGavin Andresen
I needed this to test the new "reject" p2p message, but it should be generally useful for fuzz-testing network message handling code.
2013-10-21Adding new "addrlocal" field to RPC getpeerinfo.Josh Lehan
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.
2013-10-20Merge pull request #2840 from sipa/nosendlockGavin Andresen
Allow SendMessages to run partially without cs_main
2013-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3
2013-10-15Run node deletions outside of cs_vNodesPieter Wuille
2013-10-15Merge pull request #2924 from sje397/TrafficGraphWladimir J. van der Laan
[QT] Add network traffic graph to debug window
2013-10-14Merge pull request #3077 from sipa/chainGavin Andresen
Refactor/encapsulate chain globals into a CChain class
2013-10-14Add network traffic graphScott Ellis
2013-10-11Refactor/encapsulate chain globals into a CChain classPieter Wuille
2013-10-04Added ping time measurement.Josh Lehan
New RPC "ping" command to request ping. Implemented "pong" message handler. New "pingtime" field in getpeerinfo, to provide results to user. New "pingwait" field, to show pings still in flight, to better see newly lagging peers.
2013-09-18Replace printf with LogPrintf / LogPrintGavin Andresen
2013-09-05autotools: switch to autotools buildsystemCory Fields
2013-08-24Merge pull request #2618 from fcicq/solaris-supportJeff Garzik
Partial solaris support
2013-07-31Remove #define loop from util.hGavin Andresen
Replace the loop macro with while (true). The #define caused problems for Qt.
2013-07-17Fix fcntl include in net.cpp & netbase.cppfcicq
2013-07-13fix invalid conversion error with MinGW 4.8.1 in net.cppPhilip Kaufmann
- fixes src\net.cpp:1601: Error:invalid conversion from 'void*' to 'const char*' [-fpermissive] in a setsockopt() call on Win32 that was found by using MinGW 4.8.1 compiler suite
2013-06-24Dump addresses every 15 minutes instead of 10 secondsPieter Wuille
2013-06-19Introduce a CChainParameters singleton class and regtest mode.Mike Hearn
The new class is accessed via the Params() method and holds most things that vary between main, test and regtest networks. The regtest mode has two purposes, one is to run the bitcoind/bitcoinj comparison tool which compares two separate implementations of the Bitcoin protocol looking for divergence. The other is that when run, you get a local node which can mine a single block instantly, which is highly convenient for testing apps during development as there's no need to wait 10 minutes for a block on the testnet.
2013-06-11send tx relay flag with versionbitsofproof
2013-06-10changes to thread code (directly use boost::thread)Philip Kaufmann
- removes our NewThread() function an replaces remaining calls with boost::thread with our TraceThread template - remove ExitThread() function - fix THREAD_PRIORITY_ABOVE_NORMAL for non Windows OSes
2013-06-06Removed the main.h include from net.cpp.Eric Lombrozo
2013-06-05Using boost::signals2 to message main from net.cpp.Eric Lombrozo
2013-06-05Removed net.cpp's dependency on init.h.Eric Lombrozo
Added explicit include of main.h in init.cpp, changed include of init.h to include of main.h in net.cpp. Added function registration for net.cpp in init.cpp's network initialization. Removed protocol.cpp's dependency on main.h. TODO: Remove main.h include in net.cpp.
2013-06-05Moved unrelated-to-network calls in StartNode and StopNode into init.cppEric Lombrozo