Commit graph

396 commits

Author SHA1 Message Date
Wladimir J. van der Laan 69dc5b51a0
Merge pull request #6374
027de94 Use network group instead of CNetAddr in final pass to select node to disconnect (Patrick Strateman)
000c18a Fix comment (Patrick Strateman)
fed3094 Acquire cs_vNodes before changing refrence counts (Patrick Strateman)
69ee1aa CNodeRef copy constructor and assignment operator (Patrick Strateman)
dc81dd0 Return false early if vEvictionCandidates is empty (Patrick Strateman)
17f3533 Better support for nodes with non-standard nMaxConnections (Patrick Strateman)
1317cd1 RAII wrapper for CNode* (Patrick Strateman)
df23937 Add comments to AttemptToEvictConnection (Patrick Strateman)
a8f6e45 Remove redundant whiteconnections option (Patrick Strateman)
b105ba3 Prefer to disconnect peers in favor of whitelisted peers (Patrick Strateman)
2c70153 AttemptToEvictConnection (Patrick Strateman)
4bac601 Record nMinPingUsecTime (Patrick Strateman)
ae037b7 Refactor: Move failure conditions to the top of AcceptConnection (Patrick Strateman)
1ef4817 Refactor: Bail early in AcceptConnection (Patrick Strateman)
541a1dd Refactor: AcceptConnection (Patrick Strateman)
2015-09-03 18:27:24 +02:00
Wladimir J. van der Laan af9305a7e8
Merge pull request #6583
9f3e48e add support for miniupnpc api version 14 (Pavel Vasin)
2015-08-31 17:38:07 +02:00
Patrick Strateman 027de94e1f
Use network group instead of CNetAddr in final pass to select node to disconnect 2015-08-30 22:09:14 -07:00
J Ross Nicoll 9bebf60698
Make sure LogPrint strings are line-terminated 2015-08-29 17:40:13 +01:00
Patrick Strateman 000c18aace Fix comment 2015-08-25 16:31:13 -07:00
Patrick Strateman fed30940ef Acquire cs_vNodes before changing refrence counts 2015-08-25 16:30:02 -07:00
Patrick Strateman 69ee1aab00 CNodeRef copy constructor and assignment operator 2015-08-25 15:33:29 -07:00
Cory Fields a19338723d net: Set SO_REUSEADDR for Windows too
When running the rpc tests in Wine, nodes often fail to listen on localhost
due to a stale socket from a previous run. This aligns the behavior with other
platforms.
2015-08-25 11:31:06 -04:00
Pavel Vasin 9f3e48e521 add support for miniupnpc api version 14
The value of new arg ttl is set to 2 as it's recommended default.
2015-08-23 23:53:49 +03:00
Patrick Strateman dc81dd02a1 Return false early if vEvictionCandidates is empty 2015-08-22 15:38:24 -07:00
Patrick Strateman 17f3533c84 Better support for nodes with non-standard nMaxConnections 2015-08-22 15:38:24 -07:00
Patrick Strateman 1317cd1928 RAII wrapper for CNode* 2015-08-22 15:38:24 -07:00
Patrick Strateman df23937422 Add comments to AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman a8f6e45249 Remove redundant whiteconnections option 2015-08-22 15:38:24 -07:00
Patrick Strateman b105ba398b Prefer to disconnect peers in favor of whitelisted peers 2015-08-22 15:38:24 -07:00
Patrick Strateman 2c701537c8 AttemptToEvictConnection 2015-08-22 15:38:24 -07:00
Patrick Strateman ae037b707c Refactor: Move failure conditions to the top of AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 1ef4817614 Refactor: Bail early in AcceptConnection 2015-08-22 15:38:23 -07:00
Patrick Strateman 541a1dd9e6 Refactor: AcceptConnection 2015-08-22 15:38:23 -07:00
Veres Lajos 9f68ed6b6d typofixes (found by misspell_fixer) 2015-08-10 22:06:27 +01:00
Wladimir J. van der Laan c384800027
Merge pull request #6462
7b79cbd limit total length of user agent comments (Pavol Rusnak)
557f8ea implement uacomment config parameter which can add comments to user agent as per BIP-0014 (Pavol Rusnak)
2015-08-05 15:43:10 +02:00
Pavol Rusnak 7b79cbd722 limit total length of user agent comments
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2015-08-05 09:38:20 +02:00
Matt Quinn 19dd40a25f Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
2015-08-03 14:37:00 -07:00
Pavol Rusnak 557f8eac7a implement uacomment config parameter
which can add comments to user agent as per BIP-0014
2015-07-31 16:19:23 +02:00
Peter Todd d2d7ee0e86 Make CRollingBloomFilter set nTweak for you
While CBloomFilter is usually used with an explicitly set nTweak,
CRollingBloomFilter is only used internally. Requiring every caller to
set nTweak is error-prone and redundant; better to have the class handle
that for you with a high-quality randomness source.

Additionally when clearing the filter it makes sense to change nTweak as
well to recover from a bad setting, e.g. due to insufficient randomness
at initialization, so the clear() method is replaced by a reset() method
that sets a new, random, nTweak value.
2015-07-27 18:38:49 +02:00
Wladimir J. van der Laan ca37e0f339
Merge pull request #5697
60c8bac Includes: Cleanup around net main and wallet (Jorge Timón)
9dd793f TRIVIAL: Missing includes (Jorge Timón)
2015-07-27 14:40:29 +02:00
Jorge Timón 60c8bac77c Includes: Cleanup around net main and wallet
-Move from .h to .cpp: in main, net and wallet
-Remove unnecessary #include "main.h"
-Cleanup some wallet files includes
2015-07-23 21:10:26 +02:00
Wladimir J. van der Laan d2464dfee9
Merge pull request #6287
a794284 locking: add a quick example of GUARDED_BY (Cory Fields)
2b890dd locking: fix a few small issues uncovered by -Wthread-safety (Cory Fields)
cd27bba locking: teach Clang's -Wthread-safety to cope with our scoped lock macros (Cory Fields)
2015-07-23 18:45:26 +02:00
Pieter Wuille d422f9b1fd Test whether created sockets are select()able 2015-07-10 12:05:09 -04:00
Wladimir J. van der Laan 445220544e
Merge pull request #5288
e3cae52 Added -whiteconnections=<n> option (Josh Lehan)
2015-07-10 15:07:15 +02:00
Jonas Schnelli 177a0e4914 Adding CSubNet constructor over a single CNetAddr 2015-07-02 20:44:27 +02:00
Jonas Schnelli 409bccfbf5 use CBanEntry as object container for banned nodes
- added a reason enum for a ban
- added creation time for a ban

Using CBanEntry as container will keep banlist.dat extenable.
2015-07-02 20:29:36 +02:00
Jonas Schnelli dfa174c295 CAddrDB/CBanDB: change filesize variables from int to uint64_t 2015-07-02 20:29:36 +02:00
Jonas Schnelli f581d3d656 banlist.dat: store banlist on disk 2015-07-02 20:29:36 +02:00
Jonas Schnelli 62909f68a0 fix missing lock in CNode::ClearBanned() 2015-06-19 13:31:33 +02:00
Jonas Schnelli 4e36e9bcc7 setban: rewrite to UniValue, allow absolute bantime 2015-06-17 21:40:55 +02:00
Jonas Schnelli 433fb1a95d [RPC] extend setban to allow subnets 2015-06-17 21:40:55 +02:00
Jonas Schnelli e8b93473f1 [net] remove unused return type bool from CNode::Ban() 2015-06-17 21:40:55 +02:00
Jonas Schnelli 2252fb91cd [net] extend core functionallity for ban/unban/listban 2015-06-17 21:40:55 +02:00
Cory Fields 2b890dd424 locking: fix a few small issues uncovered by -Wthread-safety
- rpcwallet: No need to lock twice here
- openssl: Clang doesn't understand selective lock/unlock here. Ignore it.
- CNode: Fix a legitimate (though very unlikely) locking bug.
2015-06-16 04:04:02 -04:00
Josh Lehan e3cae52538 Added -whiteconnections=<n> option
This sets aside a number of connection slots for whitelisted peers,
useful for ensuring your local users and miners can always get in,
even if your limit on inbound connections has already been reached.
2015-06-14 02:07:15 -07:00
Philip Kaufmann a9ac95c1bc use const references where appropriate 2015-06-04 19:34:18 +02:00
Philip Kaufmann 49b22928ee [net, trivial] explicitly use std::string for FindNode
- in OpenNetworkConnection we have a FindNode call, which gets a const
  char*, wheras we only have defined a FindNode for std::string
2015-05-31 15:44:22 +02:00
Gavin Andresen 9a1dcea2df
Use CScheduler for net's DumpAddresses
Instead of starting Yet Another Thread to dump addresses,
use CScheduler to do it.
2015-05-14 12:50:42 -04:00
Pieter Wuille d4d5022cfc Use ring buffer of set iterators instead of deque of copies in mruset 2015-04-30 08:16:30 -07:00
Gavin Andresen d81cff32e5 Replace mruset setAddrKnown with CRollingBloomFilter addrKnown
Use a probabilistic bloom filter to keep track of which addresses
we think we have given our peers, instead of a list.

This uses much less memory, at the cost of sometimes failing to
relay an address to a peer-- worst case if the bloom filter happens
to be as full as it gets, 1-in-1,000.

Measured memory usage of a full mruset setAddrKnown: 650Kbytes
Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes.

This will also help heap fragmentation, because the 37K of storage
is allocated when a CNode is created (when a connection to a peer
is established) and then there is no per-item-remembered memory
allocation.

I plan on testing by restarting a full node with an empty peers.dat,
running a while with -debug=addrman and -debug=net, and making sure
that the 'addr' message traffic out is reasonable.
(suggestions for better tests welcome)
2015-04-30 08:16:20 -07:00
Wladimir J. van der Laan f026ab606d
Merge pull request #6059
739d615 chainparams: use SeedSpec6's rather than CAddress's for fixed seeds (Cory Fields)
2015-04-30 14:57:04 +02:00
pstratem 351593b9c8 replace absolute sleep with conditional wait 2015-04-27 11:48:31 -07:00
Cory Fields 739d6155d3 chainparams: use SeedSpec6's rather than CAddress's for fixed seeds
This negates the need for CAddress here at all
2015-04-24 14:32:39 -04:00
Pieter Wuille 1d5b47a903 nLastTry is only used for addrman entries
No need to define it for every CAddress, as it's memory only anyway.
2015-04-19 11:10:23 -07:00