aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
AgeCommit message (Collapse)Author
2012-04-15fix warnings: array subscript is of type 'char' [-Wchar-subscripts]Wladimir J. van der Laan
2012-04-15work around issue in boost::program_options that prevents from compiling in ↵Wladimir J. van der Laan
clang
2012-04-12Merge pull request #1087 from sipa/fix_1086Gavin Andresen
Fix #1086: add /testnet to passed datadir
2012-04-13Fix #1086: add /testnet to passed datadirPieter Wuille
2012-04-12Fix OSX build errors.Gavin Andresen
2012-04-11Use filesystem::path instead of manual string tinkeringPieter Wuille
Where possible, use boost::filesystem::path instead of std::string or char* for filenames. This avoids a lot of manual string tinkering, in favor of path::operator/. GetDataDir is also reworked significantly, it now only keeps two cached directory names (the network-specific data dir, and the root data dir), which are decided through a parameter instead of pre-initialized global variables. Finally, remove the "upgrade from 0.1.5" case where a debug.log in the current directory has to be removed.
2012-04-11Remove path.make_preferred() calls, and fix compiler error in bitcoinrpc RE: ↵Gavin Andresen
boost::system
2012-04-10Merge pull request #1054 from sipa/buildinfoPieter Wuille
Build identification strings
2012-04-10Build identification stringsPieter Wuille
All client version information is moved to version.cpp, which optionally (-DHAVE_BUILD_INFO) includes build.h. build.h is automatically generated on supporting platforms via contrib/genbuild.sh, using git describe. The git export-subst attribute is used to put the commit id statically in version.cpp inside generated archives, and this value is used if no build.h is present. The gitian descriptors are modified to use git archive instead of a copy, to create the src/ directory in the output. This way, src/src/version.cpp will contain the static commit id. To prevent gitian builds from getting the "-dirty" marker in their git-describe generated identifiers, no touching of files or running sed on the makefile is performed anymore. This does not seem to influence determinism.
2012-04-09Merge pull request #1052 from sipa/scopedlocksPieter Wuille
Use scoped locks instead of CRITICAL_BLOCK
2012-04-09Do not report spurious deadlocks caused by TRY_LOCKPieter Wuille
2012-04-09Support for parametrized locks in deadlock detectorPieter Wuille
2012-04-09Use scoped locks instead of CRITICAL_BLOCKPieter Wuille
2012-04-06updated util.cpp to use make_preferred()Philip Kaufmann
2012-04-06Merge pull request #1033 from sipa/waitPieter Wuille
Condition variables instead of polling
2012-04-05removed obsolete boost workaround (boost ticket #4258)Philip Kaufmann
2012-04-04Locking system overhaul, add condition variablesPieter Wuille
This commit simplifies the locking system: CCriticalSection becomes a simple typedef for boost::interprocess::interprocess_recursive_mutex, and CCriticalBlock and CTryCriticalBlock are replaced by a templated CMutexLock, which wraps boost::interprocess::scoped_lock. By making the lock type a template parameter, some critical sections can now be changed to non-recursive locks, which support waiting via condition variables. These are implemented in CWaitableCriticalSection and WAITABLE_CRITICAL_BLOCK. CWaitableCriticalSection is a wrapper for a different Boost mutex, which supports waiting/notification via condition variables. This should enable us to remove much of the used polling code. Important is that this mutex is not recursive, so functions that perform the locking must not call eachother. Because boost::interprocess::scoped_lock does not support assigning and copying, I had to revert to the older CRITICAL_BLOCK macros that use a nested for loop instead of a simple if.
2012-04-04qtui.h/noui.h interface cleanupWladimir J. van der Laan
- rename wxMessageBox, remove redundant arguments to noui/qtui calls - also, add flag to force blocking, modal dialog box for disk space warning etc - clarify function naming - no more special MessageBox needed from AppInit2, as window object is created before calling AppInit2
2012-04-03VC2010 compile fixesWladimir J. van der Laan
2012-03-25remove unused functions from util.h/util.cppWladimir J. van der Laan
2012-02-28Merge branch '2012_02_getspecialfolderpath_overflow' of ↵Gavin Andresen
https://github.com/laanwj/bitcoin
2012-02-26Reworked QT settingsGavin Andresen
2012-02-26Simplify MyGetSpecialFolderPath and fix possible buffer overflow (#901)Wladimir J. van der Laan
2012-02-16Fix #846. Allow negative options such as "nolisten=1" in bitcoin.conf as ↵Chris Moore
well as on the command line.
2012-02-07Update all copyrights to 2012Gavin Andresen
2012-02-07New GetArg features: allow --, and booleans can be -foo or -nofooGavin Andresen
2012-02-07Unit tests for the GetArg() methodsGavin Andresen
2012-02-06-bip16 option (default: 1) to support / not support BIP 16. And bumped ↵Gavin Andresen
default BIP16 switchover date from Feb 15 to Mar 1
2012-01-21Add DEBUG_LOCKCONTENTION, to warn each time a thread waits to lock.Matt Corallo
If compiled with -DDEBUG_LOCKCONTENTION, Bitcoin will print to debug.log each time a thread has to wait for a lock to continue.
2012-01-13Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen
2012-01-06Network stack refactorPieter Wuille
This introduces CNetAddr and CService, respectively wrapping an (IPv6) IP address and an IP+port combination. This functionality used to be part of CAddress, which also contains network flags and connection attempt information. These extra fields are however not always necessary. These classes, along with logic for creating connections and doing name lookups, are moved to netbase.{h,cpp}, which does not depend on headers.h. Furthermore, CNetAddr is mostly IPv6-ready, though IPv6 functionality is not yet enabled for the application itself.
2012-01-03Fix issue #659, and cleanup wallet/command-line argument handling a bitGavin Andresen
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
2011-12-20Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr
2011-12-20Merge pull request #673 from mndrix/less-time-dataGavin Andresen
Store fewer time samples
2011-12-19Use std::numeric_limits<> for typesafe INT_MAX/etcGavin Andresen
2011-12-19Implement BIP 14 : separate protocol version from client versionGavin Andresen
2011-12-01Retain only the most recent time samplesMichael Hendricks
Remembering all time samples makes nTimeOffset slow to respond to system clock corrections. For instance, I start my node with a system clock that's 30 minutes slow and run it for a few days. During that time, I accumulate 10,000 offset samples with a median of 1800 seconds. Now I correct my system clock. Without this change, my node must collect another 10,000 samples before nTimeOffset is correct again. With this change, I must only accumulate 100 samples to correct the offset. Storing unlimited time samples also allows an attacker with many IP addresses (ex, a large botnet) to perform a memory exhaustion attack against Bitcoin nodes. The attacker sends a version message from each IP to his target, consuming more of the target's memory each time. Time samples are small, so this attack might be impractical under the old code, but it's impossible with the new code.
2011-12-01Only log time samples in debug modeMichael Hendricks
The full list of time samples is rarely useful outside of debugging. The node's time offset, however is useful for discovering local clock drift, so it's displayed in all logging modes.
2011-10-07Fix build on windows and macGavin Andresen
Replaced all occurrences of #if* __WXMSW__ with WIN32, and all occurrences of __WXMAC_OSX__ with MAC_OSX, and made sure those are defined appropriately in the makefile and bitcoin-qt.pro.
2011-10-01remove possibility of 63 bit overflow in ParseMoneyWladimir J. van der Laan
- also, add unit tests for various functions in util.cpp/util.h
2011-09-27Inline base64 encoder/decoderPieter Wuille
This replaces the openssl-based base64 encoder and decoder with a more efficient internal one. Tested against the rfc4648 test vectors. Decoder is based on JoelKatz' version.
2011-09-27Faster Base64 decoder.JoelKatz
2011-09-26Remove wxWidgetsGavin Andresen
Makefiles now build bitcoind only. qmake/make in top-level directory is used to build Bitcoin QT Deleted almost all #ifdef GUI from the code (left one possibly controversial one) Deleted xpm/ files.
2011-09-26Merge pull request #517 from gavinandresen/DoSpreventionGavin Andresen
Denial-of-service prevention
2011-09-21SetMockTime() for cleaner unit testingGavin Andresen
2011-09-03Merge branch 'master' of https://github.com/bitcoin/bitcoinWladimir J. van der Laan
2011-09-02If compiled -DDEBUG_LOCKORDER and run with -debug, print out every mutex ↵Gavin Andresen
lock/unlock (helpful for debugging something-is-holding-a-mutex-too-long problems)
2011-09-02Merge branch 'master' of https://github.com/bitcoin/bitcoinWladimir J. van der Laan
Conflicts: src/main.cpp
2011-08-31Highlight mis-matching locksGavin Andresen