Commit graph

26 commits

Author SHA1 Message Date
Roy Lee d35a82412f [lbry] align port settings between lbcd, lbcctl, and lbcwallet 2022-05-24 00:01:46 -07:00
Brannon King 4dd4505706 [lbry] docs: update docs for LBRY
Co-authored-by: Roy Lee <roylee17@gmail.com>
2022-05-24 00:01:46 -07:00
Roy Lee 45627c7a6a [lbry] rename btcd to lbcd
Co-authored-by: Brannon King <countprimes@gmail.com>
2022-05-23 23:53:30 -07:00
Tomasz Ziolkowski a8ad257660 reduce redundant memory allocatio - resolves btcsuite/btcd#1699
Signed-off-by: Tomasz Ziolkowski <tomasz.ziolkowski@allegro.pl>
2022-05-23 21:46:22 -07:00
Aarush Bhat 65e986844e Update connmanager_test.go 2021-11-10 07:59:03 -05:00
Jake Sylvestre d08785547a docs: update shields 2021-03-05 07:45:19 -05:00
Jin 96f3808dc9 BUG:dynamicbanscore deadlock 2020-03-09 13:41:13 -04:00
Roei Erez 9bfb2ca034 connmgr: check for canceled connection before connect
This will ensure cancelation is reliable for all cases.
2019-04-09 19:54:18 -07:00
Johan T. Halseth 4b5ff8c687
connmanager: check Addr for nil 2018-10-01 13:55:43 +02:00
Conner Fromknecht b26daffac9 connmgr: adds cancellation of pending requests
This commit extends the work started by roasbeef in the
 previous commit to bring full cancellation of pending
 connection requests. It also adds minor refactors to
 channel send/receives to help cleanup potentially
 lingering go routines.
2018-05-23 16:46:15 -07:00
Olaoluwa Osuntokun 548c0f499b connmgr: add ability to remove pending connections
This commit adds the ability for callers to remove pending connections
via a call to the Remove() method. With this change, upstream users of
this package can use the connmgr for more elaborate connectivity needs
as they can now cancel pending connections that are no longer needed.
2018-05-23 16:46:15 -07:00
Josh Rickmar a6965d493f all: Remove seelog logger.
The btclog package has been changed to defining its own logging
interface (rather than seelog's) and provides a default implementation
for callers to use.

There are two primary advantages to the new logger implementation.

First, all log messages are created before the call returns.  Compared
to seelog, this prevents data races when mutable variables are logged.

Second, the new logger does not implement any kind of artifical rate
limiting (what seelog refers to as "adaptive logging").  Log messages
are outputted as soon as possible and the application will appear to
perform much better when watching standard output.

Because log rotation is not a feature of the btclog logging
implementation, it is handled by the main package by importing a file
rotation package that provides an io.Reader interface for creating
output to a rotating file output.  The rotator has been configured
with the same defaults that btcd previously used in the seelog config
(10MB file limits with maximum of 3 rolls) but now compresses newly
created roll files.  Due to the high compressibility of log text, the
compressed files typically reduce to around 15-30% of the original
10MB file.
2017-06-19 16:46:50 -04:00
Steven Roose ef87de9d88 Fix comparator that could cause a panic 2017-06-07 17:59:33 -05:00
Steven Roose bf43e56f2f Fix warnings from ineffassign
I left one at the end of fullblocktest, since I suspected the unused
variable assignments there were set for the possibility of extending the
tests.
2017-06-07 17:59:33 -05:00
Dave Collins 9918e2a561
multi: Update markdown files for GFM changes.
The github markdown interpreter has been changed such that it no longer
allows spaces in between the brackets and parenthesis of links and now
requires a newline in between anchors and other formatting.  This
updates all of the markdown files accordingly.

While here, it also corrects a couple of inconsistencies in some of the
README.md files.
2017-05-25 12:06:16 -05:00
Javed Khan 8caa921ac3 server: Fix connections to onion nodes.
A DNS lookup was being attempted on onion addresses causing
connections to fail. This has been fixed by introducing type
onionAddr (which implements a net.Addr interface) and passing
it to btcdDial.

Also, the following onion related fixes have been made:

* getaddednodeinfo - updated to handle onion addrs.
* TorLookupIP - fixed err being shadowed.
* newServer - rename tcpAddr to netAddr
* addrStringToNetAddr - skip if host is already an IP addr.
* addrStringToNetAddr - err if tor is disabled
* getaddednodeinfo - check if host is already an IP addr.
2017-01-18 21:40:41 +05:30
David de Kloet c5751b75a9 wire: Treat NetAddress more like immutable
Replace assignments to individual fields of wire.NetAddress with
creating the entire object at once, as one would do if the type was
immutable.

In some places this replaces the creation of a NetAddress with a
high-precision timestamp with a call to a 'constructor' that converts
the timestamp to single second precision. For consistency, the tests
have also been changed to use single-precision timestamps.

Lastly, the number of allocations in readNetAddress have been reduced by
reading the services directly into the NetAddress instead of first into
a temporary variable.
2016-12-06 20:48:02 +01:00
Olaoluwa Osuntokun e8f63bc295
connmgr: switch to using net.Addr interface throughout for addresses
This commit modifies the `ConnManager` to use the `net.Add` interface
through the package instead of a plain string to represent and
manipulate addresses. This change makes the package much more general as
users of the package can possibly utilize custom implementations of the
`net.Addr` interface to establish connections.

More precisely, the `ConnReq` struct has been modified to use a net.Addr
instance explicitly, and the `DialFunc` type has also been modified to
take a `net.Addr` directly. This latter change gives functions that
adhere to the `DialFunc` type more flexibility as to exactly how the
connection is established.

Additionally, the `connmgr.Config.GetNewAddress` configuration option
now directly returns a `net.Addr. This change allows the `connmgr` to be
decoupled from all DNS queries which allows callers to preferentially
select more secure methods like performing DNS lookups over a Tor proxy.
2016-11-10 11:22:36 -08:00
Dave Collins b65881c137
connmgr: Add tests for new inbound listener logic. 2016-11-04 13:14:50 -05:00
Dave Collins d98430d8ca
connmgr: Implement inbound connection handling.
This modifies the connection manager to provide support for accepting
inbound connections on a caller-provided set of listeners and notify the
caller via a callback.

This is only the minimum work necessary to get inbound support into the
connection manager.  The intention for future commits is to move more
connection-related logic such as limiting the maximum number of overall
connections and banned peer tracking into the connection manager.
2016-11-04 13:14:44 -05:00
Dave Collins ea9bf748bb
connmgr: Remove type defs for callbacks.
This removes the type definitions for the callback functions in favor of
declaring them directly in the Config struct.  This is more consistent
with the rest of the code base and is preferred since it means callers
reviewing the documentation don't have to follow another level of
indirection to figure out the signature.
2016-11-04 13:14:39 -05:00
Javed Khan d8a6de461f connmgr: Retry only if below target outbound conns 2016-11-04 00:36:13 -05:00
Javed Khan aca9fc040c connmgr: Rename max outbound to target outbound 2016-11-04 00:36:13 -05:00
David Hill 6951d8e235 connmgr: unexport the DynamicBanScore mutex. 2016-11-01 14:53:15 -05:00
David Hill f161d6b69e chaincfg: Introduce new type DNSSeed
DNSSeed defines a DNS Seed with a hostname and whether it supports
filtering by service flag bits.
2016-10-23 15:59:15 -05:00
Javed Khan bff2ba70fd connmgr: Refactor connection management into pkg
This commit introduces package connmgr which contains connection
management related functionality.

The following is an overview of the features the package provides:

- Maintain fixed number of outbound connections
- Optional connect-only mode
- Retry persistent connections with increasing back-off
- Source peers from DNS seeds
- Use Tor to resolve DNS
- Dynamic ban scores
- Test coverage

In addition, btcd has been refactored to make use of the new package by
extending the connection manager to work with the server to source and
maintain peer connections. The following is a broad overview of the
changes to integrate the package:

- Simplify peer state by removing pending, retry peers
- Refactor to remove retries which are now handled by connmgr
- Use callback to add addresses sourced from the  DNS seed

Finally the following connection-related things have been improved as a
part of this refactor:

- Fixes 100% cpu usage when network is down (#129)
- Fixes issues with max peers (#577)
- Simplify outbound peer connections management
2016-10-22 01:11:57 -05:00