aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
AgeCommit message (Collapse)Author
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-16Remove references to X11 licenceMichael Ford
2014-12-02Regard connection failures as attempt for addrmanWladimir J. van der Laan
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.
2014-11-26Use complete path to include bitcoin-config.h.Pavel Janík
2014-10-28Add missing reserved address spaces.Matt Corallo
2014-10-06add -timeout default as constant and use themPhilip Kaufmann
- update help message text - simplify code in init to check for -timeout
2014-09-10netbase: Make SOCKS5 negotiation interruptibleWladimir J. van der Laan
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.
2014-09-08netbase: Use .data() instead of .c_str() on binary stringWladimir J. van der Laan
`.c_str()` is only guaranteed to return the data up to the first NUL character.
2014-08-26Split up util.cpp/hWladimir J. van der Laan
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.
2014-08-20Remove all other print() methodsWladimir J. van der Laan
All unused.
2014-08-18Merge pull request #4605Wladimir J. van der Laan
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)
2014-08-08small net cleanupPhilip Kaufmann
- add comment for disabling sigpipe - add closing comment in compat.h - remove redundant check in net.h
2014-07-30Add GetNetworkName functionWladimir J. van der Laan
Returns the network name for an Network enum.
2014-07-30Allow -onlynet=onion to be usedWladimir J. van der Laan
Just an alias for onlynet=tor, but matches the new name of the proxy option -onion= better.
2014-07-17net: add SetSocketNonBlocking() as OS independent wrapperPhilip Kaufmann
2014-07-17Convert closesocket 'compat wrapper' to function in netbaseWladimir J. van der Laan
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.
2014-07-08Merge pull request #4479Wladimir J. van der Laan
109849e Bugfix: strerror_r can return an error, and if it does, POSIX does not specify the content of the buffer (Luke Dashjr)
2014-07-07Bugfix: strerror_r can return an error, and if it does, POSIX does not ↵Luke Dashjr
specify the content of the buffer
2014-07-07Fix the build for windowsWladimir J. van der Laan
Problem introduced in caf6150. Thanks to @drak for noticing. Fixes #4473.
2014-07-07remove SOCKS4 support from core and GUIPhilip Kaufmann
- now we support SOCKS5 only
2014-06-27Use async name resolving to improve net thread responsivenessHuang Le
In the LookupIntern(), things changed are: 1. Call getaddrinfo_a() instead of getaddrinfo() if available, the former is a sync version of the latter; 2. Try using inet_pton()/inet_addr() to convert the input text to a network addr structure at first, if success the extra name resolving thread inside getaddrinfo_a() could be avoided; 3. An interruption point added in the waiting loop for return from getaddrinfo_a(), which completes the improve for thread responsiveness. A easy way to see the effect is to kick off a 'bitcoind stop' immediately after 'bitcoind -daemon', before the change it would take several, or even tens of, minutes on a bad network situation to wait for the running bitcoind to exit, now it costs only seconds. Signed-off-by: Huang Le <4tarhl@gmail.com>
2014-06-24replace 3 separate calls to WSAGetLastError() with 1Philip Kaufmann
2014-05-25Merge pull request #4183Wladimir J. van der Laan
f40dbee remove CPubKey::VerifyCompact( ) which is never used (Kamil Domanski) 28b6c1d remove GetMedianTime( ) which is never used (Kamil Domanski) 5bd4adc remove LookupHostNumeric( ) which is never used (Kamil Domanski) 595f691 remove LogException( ) which is never used (Kamil Domanski) f4057cb remove CTransaction::IsNewerThan which is never used (Kamil Domanski) 0e31e56 remove CWallet::AddReserveKey which is never used (Kamil Domanski)
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.
2014-05-20remove LookupHostNumeric( ) which is never usedKamil Domanski
2014-05-09net: Add CSubNet class for subnet matchingWladimir J. van der Laan
2014-05-09Use new function parseint32 in SplitHostPortWladimir J. van der Laan
Use the new function parseint32 in SplitHostPort instead of calling strtol directly.
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-09Correct some proxy related socket leaks.Gregory Maxwell
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-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-11Improve logging of failed connectionsGavin Andresen
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-10-20Bump Year Number to 2013super3
2013-10-04Hurricane Electric uses block 2001:470::, not 2011:470::David Hill
2013-09-18Replace printf with LogPrintf / LogPrintGavin Andresen
2013-09-05autotools: switch to autotools buildsystemCory Fields
2013-07-17Fix fcntl include in net.cpp & netbase.cppfcicq
2013-04-27fix !O_NONBLOCK where ~O_NONBLOCK was meantWladimir J. van der Laan
Using ! on a non-zero value will always return 0. Also remove some duplicate and superfluous code in other places.
2012-12-18Split off hash.h from util.hPieter Wuille
2012-11-09don't use memset() in privacy/security relevant code partsPhilip Kaufmann
As memset() can be optimized out by a compiler it should not be used in privacy/security relevant code parts. OpenSSL provides the safe OPENSSL_cleanse() function in crypto.h, which perfectly does the job of clean and overwrite data. For details see: http://www.viva64.com/en/b/0178/ - change memset() to OPENSSL_cleanse() where appropriate - change a hard-coded number from netbase.cpp into a sizeof()
2012-10-11Merge pull request #1913 from sipa/noi2pWladimir J. van der Laan
Remove I2P support from netbase
2012-10-11Merge pull request #1901 from laanwj/2012_10_remove_strlcpyWladimir J. van der Laan
get rid of strlcpy.h
2012-10-07Remove I2P support from netbasePieter Wuille
I2P apparently needs 256 bits to store a fully routable address. Garlicat requires a centralized lookup service to map the 80-bit addresses to fully routable ones (as far as I understood), so that's not really usable in our situation. To support I2P routing and peer exchange for it, another solution is needed. This will most likely imply a network protocol change, and extension of the 'addr' message.
2012-10-07get rid of strlcpy.hWladimir J. van der Laan
Don't use hand-rolled string manipulation routine with a fixed buffer in the bitcoin core, instead make use of c++ strings and boost.
2012-10-04add LOCK() for proxy related data-structuresPhilip Kaufmann
- fix #1560 by properly locking proxy related data-structures - update GetProxy() and introduce GetNameProxy() to be able to use a thread-safe local copy from proxyInfo and nameproxyInfo - update usage of GetProxy() all over the source to match the new behaviour, as it now fills a full proxyType object - rename GetNameProxy() into HaveNameProxy() to be more clear
2012-09-21Merge pull request #1793 from Diapolo/fix_signed_unsigned_strprintfWladimir J. van der Laan
fix signed/unsigned in strprintf and CNetAddr::GetByte()
2012-09-18Trim trailing whitespace for src/*.{h,cpp}Jeff Garzik
2012-09-12fix signed/unsigned in strprintf and CNetAddr::GetByte()Philip Kaufmann
- I checked every occurance of strprintf() in the code and used %u, where unsigned vars are used - the change to GetByte() was made, as ip is an unsigned char