Commit graph

28 commits

Author SHA1 Message Date
Gavin Andresen 882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00
Gavin Andresen a1de57a063 Compile with extra warnings turned on. And more makefile/code tidying up.
This turns on most gcc warnings, and removes some unused variables and other code that triggers warnings.
Exceptions are:
 -Wno-sign-compare : triggered by lots of comparisons of signed integer to foo.size(), which is unsigned.
 -Wno-char-subscripts : triggered by the convert-to-hex functions (I may fix this in a future commit).
2012-01-12 20:02:47 -05:00
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
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 f8ded588a2 Implement BIP 14 : separate protocol version from client version 2011-12-19 10:24:23 -05:00
Matt Corallo 2bc6cecebb Move DNS Seed lookup to a new thread. 2011-11-26 14:28:46 -05: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 15f3ad4dbd Framework for banning mis-behaving peers 2011-09-21 12:49:53 -04:00
Nils Schneider e674680ddd missed printf in AbortMessage(); merged printfs in EndMessage 2011-09-17 21:36:58 +02:00
Nils Schneider 59090133c0 log low-level network messages only when fDebug is set 2011-09-17 18:29:41 +02:00
Giel van Schijndel e4dde849ae Move CInv to protocol.[ch]pp
This commit does *not* and should not modify *any* code, it only moves
it from net.h and splits it across protocol.cpp and protocol.hpp.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-08-19 07:24:38 +02:00
Giel van Schijndel 33e28c9948 Move CAddress to protocol.[ch]pp
This commit does *not* and should not modify *any* code, it only moves
it from net.h and splits it across protocol.cpp and protocol.hpp.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-08-19 07:24:38 +02:00
Giel van Schijndel 507fd9d15b Start moving protocol-specific code to protocol.[ch]pp
Move CMessageHeader from net.h to protocol.[ch]pp, with the
implementation in the .cpp compilation unit (compiling once is enough).

This commit does *not* and should not modify *any* code, it only moves
it from net.h and splits it across protocol.cpp and protocol.hpp.

Indentation changes aside the closest thing to a modification of code is
the addition of the 'TODO' comment (the execution of which requires code
modifications and thus doesn't belong in this commit).

Signed-off-by: Giel van Schijndel <me@mortis.eu>
2011-08-19 07:24:38 +02: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 865ed8a1e5 Compile with DEBUG_LOCKORDER to detect inconsistent lock orderings that can cause deadlocks 2011-08-17 10:22:28 -04:00
Gavin Andresen 498a2c9b16 Merge pull request #458 from TheBlueMatt/copyright
Unify copyright notices.
2011-08-11 10:34:29 -07:00
Gavin Andresen c648b589be Merge pull request #459 from jgarzik/char-msgstart
Use 'unsigned char' rather than 'char' for pchMessageStart.
2011-08-10 20:01:37 -07:00
Venkatesh Srinivas 25133bd74b Use 'unsigned char' rather than 'char' for pchMessageStart.
Regarding https://bitcointalk.org/index.php?topic=28022.0

main.cpp has: "char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };"
Per discussion on the thread linked, leaving the signedness of
pchMessageStart is unsafe for values > 0x80. This patch specifies
'unsigned char' in main.cpp and net.h.

Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-08-10 22:42:43 -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
Vegard Nossum 8a62fec3ee Add missing includes to net.h 2011-08-08 14:31:08 -04: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
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
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
Doug Huff 482cb65690 Fix rfc1918 and rfc3927 compliance for ignoring non-internet-routable hosts. 2011-06-02 14:46:41 -05:00
Wladimir J. van der Laan 223b6f1ba4 make bitcoin include files more modular 2011-05-15 12:04:20 +02:00
Pieter Wuille a6a5bb7c20 Support for name lookups in -connect and -addnode
* A new option -dns is introduced that enables name lookups in
  -connect and -addnode, which is not enabled by default,
  as it may be considered a security issue.
* A Lookup function is added that supports retrieving one or
  more addresses based on a host name
* CAddress constructors (optionally) support name lookups.
* The different places in the source code that did name lookups
  are refactored to use NameLookup or CAddress instead (dns seeding,
  irc server lookup, getexternalip, ...).
* Removed ToStringLog() from CAddress, and switched to ToString(),
  since it was empty.
2011-05-10 23:49:30 +02:00
Jaromil 84c3fb07b0 directory re-organization (keeps the old build system)
there is no internal modification of any file in this commit

files are moved into directories according to established standards in
sourcecode distribution; these directories contain:

 src - Files that are used in constructing the executable binaries,
       but are not installed.

 doc - Files in HTML and text format that document usage, quirks of
       the implementation, and contributor checklists.

 locale - Files that contain human language translation of strings
          used in the program

 contrib - Files contributed from distributions or other third party
 	   implementing scripts and auxiliary programs
2011-04-23 12:10:25 +02:00
Renamed from net.h (Browse further)