55 Commits

Author SHA1 Message Date
Steven Allen
0b029388bd fix: obey the context when sending messages to peers
Related to #453 but not a fix. This will cause us to actually return early when
we start blocking on sending to some peers, but it won't really _unblock_ those
peers. For that, we need to write with a context.
2020-02-22 16:34:56 -05:00
Steven Allen
3c3e567143 fix: try to re-add existing peers when the routing table is empty
Otherwise, we could decide to _not_ add a peer, disconnect from most peers, and
be unable to query the DHT even if we're technically connected to a peer in the
DHT.
2019-12-11 18:17:27 +01:00
Steven Allen
0be0cbc50e feat: refresh and wait
We'd like to be able to refresh then _wait_ for the refresh to finish in the testground DHT tests. That way, we can:

1. Start and disable _auto_ refresh.
2. Bootstrap.
3. Refresh a couple of times till we're stable.
4. Wait to _stop_ refreshing.
5. Disconnect from and forget about all peers _not_ in our routing tables.
6. Run the actual tests without interference from the bootstrapping logic.
2019-12-10 15:41:20 +01:00
Steven Allen
ef319676a9 chore: rename bootstrap to refresh
As pointed out by raul, bootstrapping and refreshing are not the same thing.
Bootstrapping is the initial setup (i.e., connect to some initial nodes to get
started). Refreshing is the process of refreshing the routing table.
2019-11-05 23:33:53 +00:00
Steven Allen
ed244cd485 feat(bootstrap): simplify bootstrapping
* Rename triggerAutoBootstrap to autoBootstrap. This variable used to control
_triggering_ only but now completely disables automatic bootstrapping.
* Remove the BootstrapConfig. We introduced this before we switched to
functional options. Now that we're breaking the interfaces anyways, we might as
well use functional options all the way (easier to extend).
* Always query self (feedback from @raulk).
* Important: don't abort the bootstrap process if we timeout finding ourselves.
2019-11-05 22:33:05 +00:00
Steven Allen
98cf91494d chore(bootstrap): remove unecessary request structure 2019-11-05 11:15:23 +00:00
Aarsh Shah
7cce5bdd96 make bootstrap synchronous & get tests to work 2019-11-02 00:37:15 +08:00
Aarsh Shah
00fffba0aa Update dht_bootstrap.go
1) on connecting to a new peer  -> trigger self & bucket bootstrap if RT size goes below thereshold
2) accept formatting & doc suggestions in the review
3) remove RT recovery code for now -> will address in a separate PR once #383 goes in

changes as per review
2019-10-11 14:10:19 +09:00
Raúl Kripalani
31765355df
migrate to consolidated types. (#344) 2019-05-26 23:33:15 +01:00
Steven Allen
16de81932c fully close streams
That is, actually wait for the other end to send us an EOF.
2018-06-04 21:45:40 -07:00
Erin Swenson-Healey
d94deae41d make DHT protocols pluggable 2018-06-01 14:55:16 -07:00
Michael Muré
2026fcb558
document and clean small things 2018-04-01 12:38:15 +02:00
Steven Allen
395fb26a0e comment on why we lock when handling (dis)connect notifs 2018-01-08 01:02:15 -08:00
Steven Allen
64b46c1d79 avoid removing message senders when still connected 2018-01-08 00:51:06 -08:00
Steven Allen
36ae474bfd fix connection tracking race
Before, we could end up (e.g.):

1. Creating two connections (both sides connect at the same time).
2. Try to test with the first one.
3. The first connection dies.
4. Get a stream reset and think that the other side doesn't support the DHT
protocol.

We tried to fix this by checking for an EOF. Unfortunately, reset streams don't
return EOFs.

This commit also simplifies peer tracking (and saves a bit of memory).

fixes #99
2018-01-06 17:08:24 -08:00
Jeromy
068f5f2e16 demote error message to warning 2017-10-28 12:03:53 -07:00
Steven Allen
6289449066 silence context canceled error
Not really an error.
2017-10-19 12:24:49 -07:00
Jeromy
4237ef0939 fix memory leak holding onto streams unnecessarily 2017-09-19 12:00:42 -07:00
Steven Allen
003afc39bd notify: use ++ 2017-07-27 14:52:44 -07:00
Steven Allen
ba0ddf36bd notify: make locking clearer 2017-07-27 14:52:44 -07:00
Steven Allen
13a847a8bb fix race condition where we might not close an opened stream. 2017-07-27 14:52:44 -07:00
Steven Allen
a1b973ce3c Properly track connections to peers in the DHT.
fixes #70
2017-07-27 14:52:44 -07:00
Steven Allen
796e96c95f Avoid blocking in notification handlers.
This isn't the correct fix but the correct fix is probably not worth it.

introduces #70
2017-07-26 04:40:53 -07:00
Jeromy
309425500c degrade dht version checking EOF error to warning 2017-01-18 00:39:01 -08:00
Jeromy
1758fc181c fix multistream import paths 2017-01-10 08:08:47 -08:00
Jeromy
6894f33507 update dependencies after package extraction funtime 2016-10-05 12:34:28 -07:00
Jeromy
5235d5f0d3 Implement 'client only' dht logic to not have to serve dht queries 2016-09-23 23:45:35 -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
Jeromy
95553964a2 update go-libp2p
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-04 12:27:26 -07: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
47d10d7be6 update go-libp2p to 3.3.4
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-15 13:04:49 -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
Jeromy
71a8519372 update libp2p to version 3.2.2
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-06-07 00:20:06 -07: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
b0e5f253f9 update libp2p to v3.2.3
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-30 22:14:21 -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
c81d962885 update libp2p to v3.2.1
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-16 11:22:36 -07:00
Jeromy
d6e7c3de0f update deps to introduce yamux hang fix
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-05-13 13:42:46 -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
Jeromy
8cd54dd9d8 update libp2p with utp dep
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-04-27 14:10:54 -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
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
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