Commit graph

62 commits

Author SHA1 Message Date
Pieter Wuille 67a42f929b Network stack refactor
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-06 18:55:37 +01:00
Gavin Andresen 0fcf91ea1e Fix issue #659, and cleanup wallet/command-line argument handling a bit 2012-01-03 10:17:28 -05:00
Pieter Wuille a75d7066b8 Fix some address-handling deadlocks
Made three critical blocks for cs_mapAddresses smaller, and moved
writing to the database out of them. This should also improve the
concurrency of the code.
2012-01-03 02:01:56 +01:00
Wladimir J. van der Laan bde280b9a4 Revert "Use standard C99 (and Qt) types for 64-bit integers"
This reverts commit 21d9f36781.
2011-12-21 22:33:19 +01:00
Luke Dashjr 21d9f36781 Use standard C99 (and Qt) types for 64-bit integers 2011-12-20 16:52:59 -05:00
Gavin Andresen 26ce92b352 Use std::numeric_limits<> for typesafe INT_MAX/etc 2011-12-19 19:10:34 -05:00
Gavin Andresen 1f3bc1c239 Merge pull request #707 from gavinandresen/BIP14
Implement BIP 14 : separate protocol version from client version
2011-12-19 07:25:16 -08:00
Gavin Andresen f8ded588a2 Implement BIP 14 : separate protocol version from client version 2011-12-19 10:24:23 -05:00
Luke Dashjr 647734881c Add my DNS seed domain 2011-12-16 18:34:47 -05:00
Matt Corallo 61a8c0569e Add sipa's new dnsseed. 2011-12-16 11:30:36 -05:00
Gavin Andresen ca287d66f2 Merge pull request #694 from luke-jr/restore_old_miniupnp_compat
Restore compatibility with miniupnpc 1.5 (without breaking miniupnp 1.6)
2011-12-12 11:32:48 -08:00
Luke Dashjr 94b97046fd Restore compatibility with miniupnpc 1.5 (without breaking miniupnp 1.6) 2011-12-10 11:52:50 -05:00
Matt Corallo 2bc6cecebb Move DNS Seed lookup to a new thread. 2011-11-26 14:28:46 -05:00
Jeff Garzik 02d630c37f Remove vladimir's DNS seed, at his request. 2011-10-31 12:42:01 -04:00
Gavin Andresen 6853e627f1 Fix build on windows and mac
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-07 11:02:21 -04:00
Gavin Andresen 8bc52d0692 Merge pull request #558 from luke-jr/bugfix_CreateThread_ThreadSocketHandler_errReporting
Bugfix: ThreadSocketHandler creation error
2011-10-05 07:27:56 -07:00
Gavin Andresen 9ec4fa7b50 Merge pull request #561 from luke-jr/optimize_conn_adjtime
Only GetAdjustedTime once for the retry loop
2011-10-05 07:22:52 -07:00
Luke Dashjr 65ba3e2f50 Bugfix: report error creating ThreadSocketHandler thread just like the rest 2011-10-03 23:45:42 -04:00
Luke Dashjr a4e6ae101a Only GetAdjustedTime once for the retry loop 2011-10-03 23:41:47 -04:00
Gavin Andresen 15f3ad4dbd Framework for banning mis-behaving peers 2011-09-21 12:49:53 -04:00
Pieter Wuille 88367a5fb8 SocketHandler thread can be detached 2011-09-19 13:08:22 +02:00
Gavin Andresen 9406696578 Fix AddAddress cs_mapaddresses/db transaction deadlock 2011-09-06 20:28:15 -04:00
Gavin Andresen b53e277ba1 Stay connected to seed nodes; disconnecting causes problems if you are trying to make the initial blockchain download. 2011-09-02 12:25:25 -04:00
Gavin Andresen 86fd7c5af6 Give hard-coded seed nodes a random last-seen time, to randomize order they're tried. 2011-09-02 11:01:45 -04:00
Daniel Folkinshteyn bca179e8bd Update the list of seednodes.
Nodes culled from MagicalTux's database of bitcoin nodes,
http://dump.bitcoin.it/misc/
by version and longevity, and tested for connectivity.
2011-09-02 00:02:45 -04:00
Gavin Andresen dd7868364d Merge branch 'code-cleanup' of git://github.com/muggenhor/bitcoin 2011-09-01 11:52:07 -04:00
Matt Corallo b4ada906c0 Upgrade dependancies and tweak build process.
* Upgrade to use miniupnpc 1.6
* Upgrade to wxWidgets 2.9.2
* Upgrade to Bost 1.47 for Win32 Builds
2011-08-23 13:00:34 -04:00
Giel van Schijndel 99860de3c9 Make some global variables less-global (static)
Explicitly make these global variables less-global to reduce the maximum
scope of this global state.

In my experience global variables tend to be a major source of bugs. As
such the less accessible they are the less likely they are to be the
source of a bug.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-08-19 07:24:37 +02:00
Gavin Andresen 498a2c9b16 Merge pull request #458 from TheBlueMatt/copyright
Unify copyright notices.
2011-08-11 10:34:29 -07:00
Venkatesh Srinivas ec93a0e219 Test for SO_NOSIGPIPE rather than assuming all BSDs support it.
Signed-off-by: Jeff Garzik <jgarzik@exmulti.com>
2011-08-10 22:36:20 -04:00
Gavin Andresen 9f0ac16942 Do-nothing MapPort() ifndef USE_UPNP. fixes #450 2011-08-09 12:38:17 -04:00
Matt Corallo b2120e223a Unify copyright notices.
To a variation on:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2011 The Bitcoin developers
2011-08-09 13:32:52 +02:00
Johannes Henninger 1565698169 Identify as "Bitcoin + version number" when mapping UPnP port
Makes Bitcoin identify itself as "Bitcoin + version number" instead of
the nondescript "libminiupnpc" when forwarding a port via UPnP.
2011-08-01 16:34:59 +02:00
Stéphane Gimenez d655a26c9d Single DB transaction for addresses from DNS seeds 2011-07-14 03:50:06 +02:00
Patrick Varilly 8c41469140 Single DB transaction for all addresses in a message
Cuts disk activity at startup immensely
2011-07-14 03:29:07 +02:00
Giel van Schijndel 858cebed7d fix warning: unused variable 'X' [-Wunused-variable]
Remove several unused variables.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-07-13 05:10:15 +02:00
Giel van Schijndel d7f1d200ab fix warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
Don't check for a negative parameter count, because not only will it
never happen, it doesn't make any sense either.

Invalid sockets (as returned by socket(2)) are always exactly -1 (not
just negative as negative file descriptors are technically not
prohibited by POSIX) on POSIX systems.  Since we store them in SOCKET
(unsigned int), however, that really is ~0U (or MAX_UINT) which happens
to be what INVALID_SOCKET is already defined to, so an additional check
for being negative is not only unnecessary (unsigned integers aren't
*ever* negative) its redundant as well (the INVALID_SOCKET comparison is
enough).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-07-13 05:07:44 +02:00
Matt Corallo fa105b1d3a Added a couple minor things to match newer build process.
This adds the relevent patches which are applied to wx,
and updates for cross compiling.
2011-07-05 00:59:00 +02:00
Matt Corallo 013df1cc3b Give more detailed error messages for connection failure. 2011-07-02 13:25:18 +02:00
Jeff Garzik b73ab2d885 Merge pull request #368 from TheBlueMatt/dnsseed
Only use dnsseeds when not on testnet.
2011-07-01 16:33:28 -07:00
Matt Corallo ce8f78a7bb Only use dnsseeds and static seeds when not on testnet. 2011-07-01 17:33:19 +02:00
Pieter Wuille 4973174534 Limit response to getblocks to half of output buffer size
Introduce SendBufferSize() and ReceiveBufferSize(), and limit
the blocks sent as response to the "getblocks" message to
half of the active send buffer size.
2011-07-01 09:39:44 +02:00
Jeff Garzik 44d16327c1 Merge pull request #367 from TheBlueMatt/dnsseed
Add new DNSSeed dnsseed.bluematt.me.
2011-06-30 14:51:55 -07:00
Matt Corallo f03c31db82 Add new DNSSeed dnsseed.bluematt.me.
This seed will pull a random set of 20 nodes from the network which
are tested to be online instead of a static list.
2011-06-30 23:42:59 +02:00
Joerie de Gram ecd3e728b7 Fix connection failure debug output 2011-06-28 22:34:52 +02:00
Pieter Wuille 64c7ee7e6b CWallet class
* A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore.
* A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around.
* Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter
* CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions.
* Some code was moved from CWalletDB to CWallet, such as handling of reserve keys.
* Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument.
* The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable.
* Functions in main.cpp and db.cpp that are not used by other modules are marked static.
* The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.
2011-06-15 11:05:55 +02:00
Jeff Garzik 19ea44208f Merge pull request #226 from jordanlewis/betterheaders
Optimize header dependencies; improve Makefile dependency graph
2011-06-14 02:05:57 -07:00
Pieter Wuille 76d660ebd3 Faster timeout when connecting
Use non-blocking connects, and a select() call to wait a predefined
time (5s by default, but configurable with -timeout) for either
success or failure. This allows much more connections to be tried
per time unit.

Based on a patch by phantomcircuit.
2011-06-12 00:29:05 +02:00
Matt Corallo c6710c7a70 Fix CPU Usage bug when using -nolisten and have no connections. 2011-06-07 00:54:41 +02:00
Doug Huff 482cb65690 Fix rfc1918 and rfc3927 compliance for ignoring non-internet-routable hosts. 2011-06-02 14:46:41 -05:00