Commit graph

121 commits

Author SHA1 Message Date
Pieter Wuille af4006b3f5 Enforce -nodiscover better 2012-05-13 14:22:15 +02:00
Jeff Garzik 80af836ce0 Merge pull request #1277 from Diapolo/IPv6_IPv4_strings
use "IPv6" and "IPv4" in strings as these are the official spellings
2012-05-12 18:59:31 -07:00
Pieter Wuille 5a3cb32e59 Take -port into account when resolving -bind's 2012-05-13 01:26:14 +02:00
Philip Kaufmann ea933b03b4 use "IPv6" and "IPv4" in strings as these are the official spellings and make ParseNetwork() in netbase.cpp case-insensitive 2012-05-13 01:12:24 +02:00
Pieter Wuille 139d2f7c29 Keep local service information per address
Keep local service information per CNetAddr instead of per CService,
but move the port into the information kept on it.
2012-05-13 01:03:05 +02:00
Pieter Wuille 89b5616d10 Do not signal outbound semaphore if uninitialized 2012-05-13 00:49:12 +02:00
Pieter Wuille a3878873f3 Merge pull request #1021 from sipa/ipv6
IPv6 node support
2012-05-11 18:23:56 -07:00
Gregory Maxwell c05271901a Merge pull request #1260 from sipa/splitsync
Split synchronization mechanisms from util.{h,cpp}
2012-05-11 18:05:49 -07:00
Jeff Garzik b34c5f3c0f Merge pull request #1101 from jgarzik/http11
Multithreaded JSON-RPC with HTTP 1.1 Keep-Alive support
2012-05-11 09:57:08 -07:00
Pieter Wuille c59abe2589 Use semaphores instead of condition variables 2012-05-11 17:02:11 +02:00
Pieter Wuille 8f10a28890 Separate listening sockets, -bind=<addr> 2012-05-11 15:29:20 +02:00
Pieter Wuille 7fa4443f77 Keep port information for local addresses 2012-05-11 15:29:19 +02:00
Pieter Wuille 457754d2c2 Add -blocknet to prevent connections to a given network 2012-05-11 15:29:19 +02:00
Pieter Wuille 090e5b40f1 Limited relaying/storing of foreign addresses
Introduce a boolean variable for each "network" (ipv4, ipv6, tor, i2p),
and track whether we are likely to able to connect to it. Addresses in
"addr" messages outside of our network get limited relaying and are not
stored in addrman.
2012-05-11 15:29:19 +02:00
Pieter Wuille 23aa78c405 IPv6 node support
This will make bitcoin relay valid routable IPv6 addresses, and when
USE_IPV6 is enabled, listen on IPv6 interfaces and attempt connections
to IPv6 addresses.
2012-05-11 15:29:19 +02:00
Philip Kaufmann 3b6ed2294b fix an incorrect if-clause in net.cpp 2012-05-09 09:11:13 +02:00
David Joel Schwartz e9205293bd Support multi-threaded JSON-RPC
Change internal HTTP JSON-RPC server from single-threaded to
thread-per-connection model.  The IP filter list is applied prior to starting
the thread, which then processes the RPC.

A mutex covers the entire RPC operation, because not all RPC operations are
thread-safe.

[minor modifications by jgarzik, to make change upstream-ready]
2012-05-08 20:11:17 -04:00
Jeff Garzik 203f9e6c00 Merge branch 'tmp-ipv6' into merge-ipv6 2012-05-08 19:43:17 -04:00
Jeff Garzik a2ea797593 Merge pull request #1180 from jgarzik/sign-compare
Fix final sign comparison warnings
2012-05-08 13:50:27 -07:00
Pieter Wuille 19b6958cfd Added -externalip and -discover
-externalip=<ip> can be used to explicitly set the public IP address
of your node. -discover=0 can be used to disable the automatic public
IP discovery system.
2012-05-04 16:12:23 +02:00
Pieter Wuille 39857190de Support for multiple local addresses 2012-05-04 16:12:23 +02:00
Pieter Wuille 478b01d9a7 Add -seednode connections, and use this for -dnsseed + -proxydns 2012-05-04 16:11:54 +02:00
Pieter Wuille 9bab521df8 Support connecting by hostnames passed to proxy (-proxydns) 2012-05-04 16:11:54 +02:00
Jeff Garzik 061a001590 ThreadSocketHandler2(): cast to avoid signed/unsigned warning 2012-05-01 17:54:52 -04:00
Philip Kaufmann f8e4d43be7 fix compiler warning "suggest explicit braces to avoid ambiguous "else"
[-Wparentheses]" in net.cpp
2012-05-01 11:40:08 +02:00
Jeff Garzik 735a60698c Change signed->unsigned at 3 code sites
This resolves signed/unsigned comparison warnings.
2012-04-23 14:14:36 -04:00
Pieter Wuille ed6d0b5f85 Remove headers.h 2012-04-17 20:00:55 +02:00
Jeff Garzik c376ac359e Fix loop index var types, fixing many minor sign comparison warnings
foo.size() typically returns an unsigned integral type; make loop variables
match those types' signedness.
2012-04-15 16:52:09 -04:00
Jeff Garzik ab9dc75a18 The string class returns string::npos, when find() fails.
Noticed when sign-comparison warnings were enabled.
2012-04-15 16:47:24 -04:00
Wladimir J. van der Laan 11cd416525 fix warnings: unused variable 'XX' [-Wunused-variable] 2012-04-15 13:40:14 +02:00
Pieter Wuille f8dcd5ca6f Use scoped locks instead of CRITICAL_BLOCK 2012-04-09 01:59:46 +02:00
Pieter Wuille 9362da78b0 Merge pull request #1033 from sipa/wait
Condition variables instead of polling
2012-04-06 04:11:14 -07:00
Gavin Andresen f487746ded Remove half-implemented publish/subscribe system 2012-04-04 15:56:00 -04:00
Pieter Wuille 092631f0ba Condition variable for outbound connection slots
Keep a global counter for nOutbound, protected with its own waitable
critical section, and wait when all outbound slots are filled, rather
than polling.

This removes the (on average) 1 second delay between a lost connection
and a new connection attempt, and may speed up shutdowns.
2012-04-04 17:24:13 +02:00
Pieter Wuille bf1afb02ca Give DNS seeds a random age between 3 and 7 days old
This speeds up initial connections with an old/large addr.dat a lot.
2012-03-25 16:06:16 +02:00
Gavin Andresen a6b4a11385 Merge branch 'addrman' of https://github.com/sipa/bitcoin 2012-03-22 09:19:01 -04:00
Alistair Buxton bb13d056ea When disconnecting a node, clear the received buffer so that we do
not process any already received messages.

The primary reason to do this is if a node spams hundreds of messages
and we ban them, we don't want to continue processing the rest of it.
2012-03-18 03:03:24 +00:00
nomnombtc f8c478c4fb fix typo src/net.cpp 2012-03-05 19:33:24 +01:00
Gavin Andresen 972060ce0e bitcoind changes to stop storing settings in wallet.dat. 2012-02-26 23:21:33 +01:00
Pieter Wuille 5fee401fe1 CAddrMan: stochastic address manager
Design goals:
 * Only keep a limited number of addresses around, so that addr.dat does not grow without bound.
 * Keep the address tables in-memory, and occasionally write the table to addr.dat.
 * Make sure no (localized) attacker can fill the entire table with his nodes/addresses.

See comments in addrman.h for more detailed information.
2012-02-24 13:41:04 +01:00
Pieter Wuille a3342d096f Fix #626: RecvLine wrong error message
Also moved RecvLine to net.cpp.
2012-02-19 19:06:42 +01:00
Pieter Wuille c59881eaee Symbolic names for threads
Introduce an enum threadId, and use symbolic indices when accessing
vnThreadsRunning.
2012-02-16 12:43:06 +01:00
Pieter Wuille 999b4cacaf Merge pull request #844 from sipa/shutdownfix
Several shutdown-related fixes
2012-02-16 03:34:11 -08:00
Pieter Wuille cc201e01f8 Several shutdown-related fixes
* do not let vnThreadsRunning[1] go negative
* do not perform locking operations while vnThreadsRunning[1] is decreased
* check vnThreadsRunning[1] at exit
2012-02-15 21:17:15 +01:00
Pieter Wuille 25ab17585e Bugfix: do not create CAddress for invalid accepts 2012-02-15 20:56:29 +01:00
Matt Corallo baba6e7de2 Get ext. IP from UPnP, make sure addrMe IsRoutable() in version.
This fixes a potential bug where some NATs may replace the node's
interal IP with its external IP in version messages, causing
incorrect checksums when version messages begin being checksummed
on February 14, 2012.
2012-02-10 00:54:11 -05:00
Gavin Andresen 882164196e Update all copyrights to 2012 2012-02-07 11:28:30 -05:00
Gavin Andresen 9d952d17bb Look for flushwallet/listen/irc/dnsseed/upnp instead of noflushwallet/etc. And switch default for irc to 0. 2012-02-07 09:14:31 -05:00
Gregory Maxwell 5d1b8f1725 Avoid advertising the node's address when it is not listening or IsInitialBlockDownload().
This also avoids flushing setAddrKnown until 24 hours has passed,
and avoids contacting the external IP services when not listening.

Advertising non-listening nodes is just addr message spam.
It doesn't help the network, in fact it hurts the network,
and it also hurts user's privacy.

Advertising far out of sync nodes doesn't help the network—
they can't even forward (most) transactions and wastes nodes
outbound slots.
2012-02-01 18:08:03 -05:00
Matt Corallo 177dbcaace Fix UPnP by reannouncing every 20 minutes. 2012-01-31 17:42:15 -05:00