aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)Author
2013-04-29Try to increase file descriptor rlimit if necessaryPieter Wuille
As the default can be too low, especially on OSX.
2013-04-06small indentation, space, formatting fixes (no code changes)Philip Kaufmann
2013-04-03Clean up shutdown processGavin Andresen
2013-04-03LoopForever and ThreadTrace helpersGavin Andresen
2013-04-03Rename util.h Sleep --> MilliSleepGavin Andresen
Two reasons for this change: 1. Need to always use boost::thread's sleep, even on Windows, so the sleeps can be interrupted (prior code used Windows' built-in Sleep). 2. I always forgot what units the old Sleep took.
2013-04-03Shutdown cleanup prep-workGavin Andresen
Create a boost::thread_group object at the qt/bitcoind main-loop level that will hold pointers to all the main-loop threads. This will replace the vnThreadsRunning[] array. For testing, ported the BitcoinMiner threads to use its own boost::thread_group.
2013-02-22Merge pull request #2229 from sipa/preallocGavin Andresen
Native versions for AllocateFileRange()
2013-02-22Merge pull request #2312 from gmaxwell/random_randomGavin Andresen
ApproximateBestSubset internal RNG to prevent degenerate behavior.
2013-02-22Merge pull request #2160 from petertodd/add-adjustedtime-to-rpc-getinfoGavin Andresen
Add adjustedtime to getinfo RPC call
2013-02-18Internal RNG for approximateBestSubset to prevent degenerate behavior.Gregory Maxwell
This fixes test_bitcoin failures on openbsd reported by dhill on IRC. On some systems rand() is a simple LCG over 2^31 and so it produces an even-odd sequence. ApproximateBestSubset was only using the least significant bit and so every run of the iterative solver would be the same for some inputs, resulting in some pretty dumb decisions. Using something other than the least significant bit would paper over the issue but who knows what other way a system's rand() might get us here. Instead we use an internal RNG with a period of something like 2^60 which is well behaved. This also makes it possible to make the selection deterministic for the tests, if we wanted to implement that.
2013-01-30Drop padding in blk* when finalizing filePieter Wuille
2013-01-11Add timeoffset to getinfo RPC callPeter Todd
Provides a method to get the difference between network adjusted time and local time from the RPC interface.
2013-01-01OutputDebugStringF code cleanupGavin Andresen
Initialize the OutputDebugStringF mutex and file pointer using boost::call_once, to be thread-safe. Make the return value of OutputDebugStringF really be the number of characters written (*printf() semantics). Declare the fReopenDebugLog flag volatile, since it is changed from a signal handler. And don't declare OutputDebugStringF() as inline.
2012-12-18Split off hash.h from util.hPieter Wuille
2012-12-12Merge pull request #2059 from sipa/benchmarkGavin Andresen
Add -benchmark for reporting block processing times
2012-12-06Allow lengthy block reconnections to be interruptedPieter Wuille
When the coin database is out of date with the block database, the best block in it is automatically switched to. This reconnection process can take time, so allow it to be interrupted. This also stops block connection as soon as shutdown is requested, leading to a faster shutdown.
2012-12-05Add GetTimeMicros() for ore accurate benchmarkingPieter Wuille
2012-11-29Add GetTempPath() to utilPieter Wuille
2012-10-20Pre-allocate block and undo files in chunksPieter Wuille
Introduce a AllocateFileRange() function in util, which wipes or at least allocates a given range of a file. It can be overriden by more efficient OS-dependent versions if necessary. Block and undo files are now allocated in chunks of 16 and 1 MiB, respectively.
2012-10-01Extend printf warnings to error()Wladimir J. van der Laan
2012-09-30harmonize printf format charactersPhilip Kaufmann
- remove the "%" character from format characters for (s)size_t and ptrdiff_t and harmonize them with the ones for int64 and uint64
2012-09-28Remove stack randomizationPieter Wuille
2012-09-25Merge pull request #1807 from laanwj/2012_09_printf_warningsWladimir J. van der Laan
Add printf-style warnings to strprintf() and OutputDebugStringF()
2012-09-18Trim trailing whitespace for src/*.{h,cpp}Jeff Garzik
2012-09-10Add format characters for (s)size_t and ptrdiff_tWladimir J. van der Laan
2012-09-10HexStr: don't build a vector<char> firstWladimir J. van der Laan
Also const correctness for lookup tables in hex functions throughout the code.
2012-09-09Cleanup some unused macros from util.hWladimir J. van der Laan
Encapsulate _snprintf/sprintf difference in implementation not header
2012-09-09Add printf-style warnings to strprintf() and OutputDebugStringF()Wladimir J. van der Laan
This finds about ~150 potential problems with format characters on a 64 bit build.
2012-08-29Rename CreateThread to NewThreadWladimir J. van der Laan
Prevent clash with win32 API symbol
2012-08-29implement CreateThread with boost::threadWladimir J. van der Laan
I'm not sure why this wasn't done before. - Removes typedef of pthread_t on Windows, which fixes a native compile issue on mingw.
2012-08-02fix further spelling errors / remove a tab in the sourcePhilip Kaufmann
2012-08-01Bugfix: Fix a variety of misspellingsLuke Dashjr
2012-07-17Give threads a recognisable name to aid in debuggingGiel van Schijndel
NOTE: These thread names are visible in gdb when using 'info threads'. Additionally both 'top' and 'ps' show these names *unless* told to display the command-line instead of task name. Signed-off-by: Giel van Schijndel <me@mortis.eu>
2012-07-07CHashWriter that does SHA256 in-place during serializationPieter Wuille
2012-06-23Merge pull request #1174 from sipa/torhsGregory Maxwell
Tor hidden service support
2012-06-22Merge pull request #1458 from jgarzik/tracenetJeff Garzik
Introduce -tracenet option, thereby quieting some redundant debug messages
2012-06-22Introduce -debugnet option, thereby quieting some redundant debug messagesJeff Garzik
Prior to this change, each TX typically generated 3+ debug messages, askfor tx 8644cc97480ba1537214 0 sending getdata: tx 8644cc97480ba1537214 askfor tx 8644cc97480ba1537214 1339640761000000 askfor tx 8644cc97480ba1537214 1339640881000000 CTxMemPool::accept() : accepted 8644cc9748 (poolsz 6857) After this change, there is only one message for each valid TX received CTxMemPool::accept() : accepted 22a73c5d8c (poolsz 42) and two messages for each orphan tx received ERROR: FetchInputs() : 673dc195aa mempool Tx prev not found 1e439346fc stored orphan tx 673dc195aa (mapsz 19) The -debugnet option, or its superset -debug, will restore the full debug output.
2012-06-22Base32 encoding/decodingPieter Wuille
2012-06-18Merge branch 'signbugs' of https://github.com/wizeman/bitcoinGavin Andresen
Resolved minor conflict in main.cpp
2012-06-07Move NOINLINE definition to test where it's used.Ricardo M. Correia
2012-06-07Don't overflow integer on 32-bit machines.Ricardo M. Correia
This was causing test_bitcoin to abort on a 32-bit system likely due to -ftrapv.
2012-05-31Fix noinline definition so that it works for more compilers.Ricardo M. Correia
2012-05-23Refactor: move runCommand() to util.cppJeff Garzik
2012-05-22Merge branch 'optimize'Gavin Andresen
2012-05-21Merge pull request #917 from mndrix/reopen-log-filePieter Wuille
Reopen log file on SIGHUP
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-20Merge pull request #1302 from laanwj/2012_05_utilstringsWladimir J. van der Laan
Get rid of snprintf (except one) with fixed buffers, shorten code
2012-05-18Reopen debug.log on SIGHUPMichael Hendricks
The best log rotation method formerly available was to configure logrotate with the copytruncate option. As described in the logrotate documentation, "there is a very small time slice between copying the file and truncating it, so some logging data might be lost". By sending SIGHUP to the server process, one can now reopen the debug log file without losing any data.
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-17Refactor: GetRandHash() method for utilGavin Andresen