99 Commits

Author SHA1 Message Date
Steven Allen
e6a4d6a3dd fix(query): cancel the context when the query finishes 2020-02-27 17:47:15 -08:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Steven Allen
1cccee0f65 query: fix a goroutine leak when the routing table is empty
When the routing table is empty, `Run` would fail but _not_ close the
process (leaking some query goroutines). This patch fixes this in multiple
places by:

1. Not starting queries with no peers.
2. Failing queries with no peers earlier.
2019-04-26 12:55:45 -07:00
Steven Allen
3c9f5bcd92 query: fix error "leak"
Long-running queries can build up large error sets that we never actually use.
This is exacerbated by https://github.com/libp2p/go-libp2p-swarm/pull/115.

fixes https://github.com/libp2p/go-libp2p-swarm/issues/119
2019-04-24 08:36:53 -07:00
Matt Joiner
86d78dc072
golangci-lint run -D errcheck (#298) 2019-03-14 11:07:15 +11:00
Raúl Kripalani
b649bcbec6 defer dialqueue action until initial peers have been added. 2019-03-13 21:25:36 +00:00
Matt Joiner
ac6772539b
Add find peer success addr to peerstore (#296)
When a peer is found, add its addr to the peerstore, just like the addresses for closer peers are added. In particular this is helpful for followup queries by the DHT user.
2019-03-12 20:08:07 +11:00
Steven Allen
c78d1e6786 fix(dialQueue): account for failed dials
fixes #276
2019-02-26 19:57:54 -07:00
Matt Joiner
61d3de0d41 Fix deadline handling in runBootstrap subqueries 2019-02-15 14:53:03 +11:00
Matt Joiner
8b37385468 Rename log to logger 2019-02-03 13:14:35 +11:00
Raúl Kripalani
ebcfcd46a6 make dial queue parameters configurable. 2019-02-01 13:43:27 +11:00
Matt Joiner
7246a3b0f4 Fix races with DialQueue variables 2019-01-31 13:08:45 +11:00
Raúl Kripalani
74d22f3f5e park waiters in slice; revise closure logic. 2019-01-30 23:25:10 +00:00
Raúl Kripalani
f2df3ec540 fix shutdown logic; fix timer logic. 2019-01-29 20:49:04 +00:00
Raúl Kripalani
abacfe5fc9 refactor interface of Consume(). 2019-01-29 16:47:42 +00:00
Raúl Kripalani
5e74c4a6f2 introduce adaptive queue for DHT dials.
This patch introduces an adaptive dial queue that spawns a dynamically sized
set of goroutines to preemptively stage dials for later handoff to the DHT
protocol for RPC. It identifies backpressure on both ends (dial consumers and
dial producers), and takes compensating action by adjusting the worker pool.

We start with `DialQueueMinParallelism` number of workers (6), and scale up
and down based on demand and supply of dialled peers.

The following events trigger scaling:
- we scale up when we can't immediately return a successful dial to a new
  consumer.
- we scale down when we've been idle for a while waiting for new dial
  attempts.
- we scale down when we complete a dial and realise nobody was waiting for it.

Dialler throttling (e.g. FD limit exceeded) is a concern, as we can easily
spin up more workers to compensate, and end up adding fuel to the fire. Since
we have no deterministic way to detect this for now, we hard-limit concurrency
to `DialQueueMaxParallelism` (20).
2019-01-29 00:56:12 +00:00
Gustvo Chain
70d5802fce Remove outdated package documentation
Both, dht.go and dht_bootstrap.go duplicate the package documentation.
The whole block had been moved to doc.go

Also query.go provides documentation for query package but now it
belongs to dht package, so it's been removed.
2019-01-09 14:21:14 +11:00
Steven Allen
eb3e7fe95f fix a potential DHT query hang
Without this, one of the workers may hang when trying to re-grab the rate-limit
after dialing. I believe this may be what's causing some of our DHT requests to
stall (evidence: massive goroutine buildup on the gateways).
2018-12-26 22:29:25 -08:00
Jeromy
6b33279a0f make getclosestpeers only return peers we can actually connect to 2018-06-06 22:49:17 -07:00
Jeromy
1290c4ef29 better check for connectedness 2018-06-06 22:49:14 -07:00
Michael Muré
2026fcb558
document and clean small things 2018-04-01 12:38:15 +02:00
Jeromy
00b46e0cf7 Fixes for dht findpeer queries
First, we use Alpha instead of K as the number of peers we grab from the
routing table (as per the kademlia paper).

Second, we don't use a size limited set for the 'GetClosestPeers' query.
We're going to process more than K peers before we find the K closest
peers.

Third, Change GetClosestPeers to actually return the K Closest peers,
not a hodge podge of peers that it found on the way to finding the
closest peers.
2017-03-05 21:36:46 -08:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
e00b3ca0a4 use stdlib context and clean up deps 2016-09-30 10:24:03 -07:00
Jeromy
c372d79e42 switch to strings and cids instead of keys 2016-09-30 10:13:57 -07:00
George Antoniadis
30d43d22e0 Fix dependencies 2016-09-02 20:21:23 +01:00
George Antoniadis
5f3e63aa46 Undo gx rewrites and add gx package.json 2016-08-21 17:18:58 +01:00
Jakub Sztandera
22af8d1151 Update go-log in whole dependency tree (#2898)
* Update golog in go-ipfs

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-secio for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-crypto for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p-peer for go-log

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Import peersore, it wasn't imported

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peerstore

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update peer

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update secio

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

* Update go-libp2p

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-24 09:38:07 -07:00
Jeromy
63b6db0589 pull in libp2p updates with utp fixes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-11 10:33:44 -07:00
Jakub Sztandera
2b3334c4a4 Update go-log
https://github.com/ipfs/go-log/pull/3

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-09 23:37:09 +02:00
Jeromy
5f777f323b update libp2p to v3.3.1
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-01 16:45:46 -07:00
Jeromy
26beb1f3d0 update go-libp2p 3.2.2, nil maddr fixes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-17 10:23:10 -07:00
Jeromy
b9f86c8c87 update libp2p with go-multiaddr and go-stream-muxer updates
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-10 16:06:28 -07:00
Hector Sanjuan
0a60fad1cd Update go-log to 1.1.0 and fix calls to go-log.Uuid
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2016-05-04 23:17:21 +02:00
Lars Gierth
38ff911ada Use extracted go-libp2p-crypto, -secio, -peer packages
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-04-16 21:48:06 -07:00
Lars Gierth
aa46264d8a Update go-libp2p
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-04-16 21:23:47 -07:00
Jeromy
75844fe336 update libp2p dep to fix hanging listeners problem
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-04-11 12:52:54 -07:00
Jeromy
3b906cf41c switch to new libp2p with mss crypto
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-04-07 15:55:41 -07:00
Jeromy
81971d0a2b update utp and cleanup more godeps along the way
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-03-29 19:18:14 -07:00
Jeromy
17edbc0725 update libp2p dep
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-03-09 09:53:19 -08:00
Jeromy
98ab3675cc Use gx vendored go-ipfs-utils where possible
For the rest of the packages in util, move them to thirdparty
and update the references. util is gone!

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-02-12 17:21:40 -08:00
Jeromy
e87bf15e58 remove goprocess from godeps, use gx vendored one
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-02-12 17:21:40 -08:00
Jeromy
77f09ba180 do that last thing again
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-31 15:37:39 -08:00
Jeromy
32f70d517b update libp2p dep
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-31 10:19:50 -08:00
Jeromy
b9e978714f correct go-log dep
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-30 09:34:10 -08:00
Jeromy
7467be3711 go-keyspace dep from libp2p added
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-30 09:34:08 -08:00
Jeromy
a5e5c57f3a initial vendoring of libp2p outside of the repo with gx
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-30 09:34:06 -08:00
Jeromy
bc9ceab87e drop error log down to debug
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-11-09 23:18:38 -08:00
Juan Benet
440f66f1c8 Merge pull request #1943 from ipfs/dht/speed
fix swarm dial backoff
2015-11-10 06:41:54 +00:00
Jeromy
39d1e2146d Add in some more notifications to help profile queries
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-11-08 13:09:36 -08:00