Commit graph

242 commits

Author SHA1 Message Date
Wladimir J. van der Laan d004d7279f Move CAddrDB frrom db to net
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-12-04 12:46:13 +01:00
Mike Hearn a946aa8d3e Store and use a sanitized subVer 2013-11-26 13:26:00 +01:00
Wladimir J. van der Laan d980f9b7d6
Merge pull request #3257
379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
2013-11-20 16:18:33 +01:00
Philip Kaufmann fabba0e6cc orphan spaces cleanup ;-) 2013-11-15 12:24:34 +01:00
Philip Kaufmann 379778bde6 core: remove includes in .cpp, if header is already in .h
- 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-15 12:20:16 +01:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
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-10 09:36:28 -06:00
Patrick Strateman 75ef87dd93 process received messages one at a time without sleeping between messages 2013-11-03 20:25:50 -08:00
Gavin Andresen 9038b18f46 -fuzzmessagestest=N : randomly corrupt 1-of-N sent messages
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-29 11:20:14 +10:00
Josh Lehan 547c61f8d8 Adding new "addrlocal" field to RPC getpeerinfo.
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-21 02:23:05 -07:00
Gavin Andresen 749230d05c Merge pull request #2840 from sipa/nosendlock
Allow SendMessages to run partially without cs_main
2013-10-20 19:06:53 -07:00
Pieter Wuille 9b1200c23b
Merge pull request #3119
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20 22:25:44 +02:00
super3 db0e8ccd90 Bump Year Number to 2013 2013-10-20 15:25:06 -04:00
Pieter Wuille 49d754d915 Run node deletions outside of cs_vNodes 2013-10-15 22:34:25 +02:00
Wladimir J. van der Laan f0c25cf6ec Merge pull request #2924 from sje397/TrafficGraph
[QT] Add network traffic graph to debug window
2013-10-15 03:48:22 -07:00
Gavin Andresen b9beea6e9d Merge pull request #3077 from sipa/chain
Refactor/encapsulate chain globals into a CChain class
2013-10-14 20:39:00 -07:00
Scott Ellis ce14345a89 Add network traffic graph 2013-10-14 19:02:03 +11:00
Pieter Wuille 4c6d41b8b6 Refactor/encapsulate chain globals into a CChain class 2013-10-11 23:25:50 +02:00
Josh Lehan 971bb3e901 Added ping time measurement.
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-10-04 01:30:12 -07:00
Gavin Andresen 881a85a22d Replace printf with LogPrintf / LogPrint 2013-09-18 20:39:25 +10:00
Cory Fields 35b8af9226 autotools: switch to autotools buildsystem 2013-09-05 21:31:03 -04:00
Jeff Garzik 3d86e7cd48 Merge pull request #2618 from fcicq/solaris-support
Partial solaris support
2013-08-24 20:19:24 -07:00
Gavin Andresen 050d2e953f Remove #define loop from util.h
Replace the loop macro with while (true). The #define caused
problems for Qt.
2013-07-31 14:06:44 +10:00
fcicq 98148a713e Fix fcntl include in net.cpp & netbase.cpp 2013-07-17 16:51:40 +08:00
Philip Kaufmann b3e0aaf36e fix invalid conversion error with MinGW 4.8.1 in net.cpp
- 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-07-13 13:05:04 +02:00
Pieter Wuille c43da3f183 Dump addresses every 15 minutes instead of 10 seconds 2013-06-24 11:48:14 +02:00
Mike Hearn 0e4b317555 Introduce a CChainParameters singleton class and regtest mode.
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-19 16:28:52 +02:00
bitsofproof c87f462b74 send tx relay flag with version 2013-06-11 23:29:41 +02:00
Philip Kaufmann 53e71135de changes to thread code (directly use boost::thread)
- 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-10 19:49:54 +02:00
Eric Lombrozo 6e68524e95 Removed the main.h include from net.cpp. 2013-06-06 00:04:33 -07:00
Eric Lombrozo 501da2503a Using boost::signals2 to message main from net.cpp. 2013-06-05 23:15:20 -07:00
Eric Lombrozo 663224c232 Removed net.cpp's dependency on init.h.
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-05 20:36:10 -07:00
Eric Lombrozo 4751d07efd Moved unrelated-to-network calls in StartNode and StopNode into init.cpp 2013-06-05 20:36:10 -07:00
Eric Lombrozo 8926263dde Moved PushGetBlocks to main.cpp to eliminate dependence of net.cpp on CBlockLocator. 2013-06-05 20:36:10 -07:00
Pieter Wuille a9d9f0f5f7 Do not kill connections on recv buffer overflow
Instead of killing a connection when the receive buffer overflows,
just temporarily halt receiving before that happens. Also, no
matter what, always allow at least one full message in the receive
buffer (otherwise blocks larger than the configured buffer size
would pause indefinitely).
2013-05-01 20:56:50 +02:00
Pieter Wuille ba29a5590b Try to increase file descriptor rlimit if necessary
As the default can be too low, especially on OSX.
2013-04-29 01:46:24 +02:00
Wladimir J. van der Laan d23fa49c52 move WSAStartup to init
WSAStartup should be called before using any other socket
functions. BindListenPort is not called if not listening.

Closes #2585.
2013-04-28 08:54:27 +02:00
Gavin Andresen 1fd3ed25be Merge pull request #2461 from sipa/syncnode
Make sure we always have a node to do IBD from
2013-04-09 10:51:06 -07:00
Jeff Garzik 1483aac5f9 net.cpp: Do not change primary process name from (default) to "bitcoin-start"
Discussed a bit on IRC.
2013-04-08 22:02:57 -04:00
Pieter Wuille b7b774d82f Merge pull request #2419 from sipa/noreltime
Drop release times for CNode
2013-04-08 08:21:06 -07:00
Pieter Wuille 86648a8d16 Add bytessent, bytesrecv and syncnode to getpeerinfo 2013-04-07 19:31:13 +02:00
Pieter Wuille 6ed71b5e4f Make sure we always have a node to do IBD from
This introduces the concept of the 'sync node', which is the one we
asked for missing blocks. In case the sync node goes away, a new one
will be selected.

For now, the heuristic is very simple, but it can easily be extended
later to add better policies.
2013-04-07 19:19:13 +02:00
Philip Kaufmann b001c87126 small indentation, space, formatting fixes (no code changes) 2013-04-06 02:29:33 +02:00
Pieter Wuille cedaa71446 Drop release times for CNode
It seems there were two mechanisms for assessing whether a CNode
was still in use: a refcount and a release timestamp. The latter
seems to have been there for a long time, as a safety mechanism.

However, this timer also keeps CNode objects alive for far longer
than necessary after disconnects, potentially opening up a DoS
window.

This commit removes the timestamp-based mechanism, and replaces
it with an assert(nRefCount >= 0), to verify that the refcounting
is indeed correctly working.
2013-04-04 14:45:45 +02:00
Gavin Andresen aaf47eac3a Merge pull request #2423 from TheBlueMatt/limitedmapalreadyaskedfor
Limited mapAlreadyAskedFor
2013-04-03 18:31:35 -07:00
Gavin Andresen b31499ec72 Clean up shutdown process 2013-04-03 19:57:53 -04:00
Gavin Andresen 21eb5adadb Port Thread* methods to boost::thread_group 2013-04-03 19:57:13 -04:00
Gavin Andresen 1b43bf0d3a Rename util.h Sleep --> MilliSleep
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-03 14:04:21 -04:00
Gavin Andresen c8c2fbe07f Shutdown cleanup prep-work
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-04-03 14:04:21 -04:00
Gavin Andresen d8aae1ce1d Merge pull request #2420 from sipa/globclean
Global cleanups
2013-04-02 10:00:31 -07:00
Matt Corallo b5afda67f2 Move mapAlreadyAskedFor to limitedmap
This will result in re-requesting invs if we are under heavy inv
load, however as long as we get no more than 16,000 invs in two
minutes, this should have no effect on runtime behavior.
2013-04-01 11:56:23 -04:00