374 Commits

Author SHA1 Message Date
Pierre Krieger
b8dfa724fd
Add some helpers for substream upgrades (#896)
* Add some helpers for substream upgrades

* Fix compilation

* Fix compilation for 32bits

* Fix some concerns

* Add read_one_then

* Fixes
2019-01-29 16:20:14 +01:00
Dan Robertson
fe4fc8c363 Move final crates to 2018 edition (#886) 2019-01-29 11:02:29 +01:00
Pierre Krieger
df923526ca
Embed the topology in the NetworkBehaviour (#889)
* Embed the topology in the NetworkBehaviour

* Put topologies inside of Floodsub and Kad

* Fix core tests

* Fix chat example

* More work

* Some cleanup

* Restore external addresses system
2019-01-26 23:57:53 +01:00
Pierre Krieger
30c082dfe5
Properly shut down protocols handler on useless timeout (#892) 2019-01-25 15:56:32 +01:00
Pierre Krieger
d9b30c6c6a
Make nodes generic over PeerId (#881) 2019-01-23 17:44:40 +01:00
Pierre Krieger
a2ab7ff4a9
Simplify the floodsub handler (#868) 2019-01-22 14:45:03 +01:00
badb
d59ec09a83 Add a maximum limit to the number of listeners (#809)
* add max_listeners to swarm

* add swarm builder

* swarm_builder's build takes ownership of self

* replace max listeners with incoming limit

* don't disconnect from node after incoming limit has been reached

* update code according to recent changes

* don't poll listeners at all if incoming connection limit is reached
2019-01-22 11:59:59 +01:00
Pierre Krieger
ad27a468f8
Deny connection with local PeerId (#859) 2019-01-17 12:20:02 +01:00
Pierre Krieger
21d219ef45
Bump to v0.2.1 (#851) 2019-01-14 14:58:07 +01:00
Pierre Krieger
bf52e9bd19
Add IntoNodeHandler and IntoProtocolsHandler traits (#848)
* Add IntoNodeHandler

* Add IntoProtocolsHandler
2019-01-14 14:22:25 +01:00
Pierre Krieger
e39d6d8bd2
Version 0.2 (#841) 2019-01-10 13:27:45 +01:00
Pierre Krieger
b8a312f7d5
Forbid dialing self (#839) 2019-01-10 11:49:36 +01:00
Pierre Krieger
dbff125df2
Add an Error associated type to transports (#835)
* Add an Error associated type to transports

* Improve raw swarm a bit

* Rename map_other to map

* Use source() instead of cause()

* RawSwarmIncErr -> IncomingError
2019-01-10 11:27:06 +01:00
Pierre Krieger
1e7fcc6d61
Move tests to separate files (#827) 2019-01-09 15:48:56 +01:00
Toralf Wittner
f1959252b7
multistream-select: Less allocations. (#800) 2019-01-09 15:09:35 +01:00
Pierre Krieger
aedf9c0c31
Add more methods on Topology (#826)
* Add more methods on Topology

* Add a DisconnectReason
2019-01-09 13:13:21 +01:00
Pierre Krieger
64b388ddd1
Add RawSwarm::incoming_negotiated (#821)
* Add RawSwarm::incoming_negotiated

* More tweaks

* Docfix
2019-01-07 11:54:42 +01:00
Pierre Krieger
5742a0000e
Add documentation to the core (#820) 2019-01-07 11:39:08 +01:00
Pierre Krieger
2eb7fe7c64
Switch libp2p-core to edition 2018 (#819) 2019-01-07 11:21:09 +01:00
Pierre Krieger
7da1a860be
Automatically close useless connections (#816)
* Automatically close useless connections

* Add a timeout before dropping the connection

* Rework the timeout

* Use OR to combine the outcome
2019-01-04 12:02:39 +01:00
Pierre Krieger
2c2fc8bfd3
Don't allow handlers::poll() to return None (#811) 2019-01-02 14:22:23 +01:00
Pierre Krieger
f903e2b744
Add version numbers of multi* deps (#810) 2019-01-02 13:45:23 +01:00
Pierre Krieger
7798e23e78
Add an error associated type to ProtocolsHandler (#795) 2018-12-28 15:11:35 +01:00
Pierre Krieger
d10cafa804
Make deriving the NetworkBehaviour more ergonomic (#782) 2018-12-20 15:21:13 +01:00
Toralf Wittner
6be3aca768
Cleanup. (#803)
- Use `Error::source` instead of `Error::cause`.
- Remove unused import.
2018-12-20 13:41:11 +01:00
Pierre Krieger
83320e0347
More precise error passed to inject_dial_upgrade_error (#771)
* More precise error passed to inject_dial_upgrade_error

* Fix concerns

* Fix panic proof
2018-12-18 11:23:13 +01:00
Pierre Krieger
40a503fd63
Store information about the local node in the topology (#772)
* Store information about the local node in the topology

* Fix build

* Store the external addresses in the topology
2018-12-13 19:06:13 +01:00
Pierre Krieger
69684a97b2
More precise errors in the nodes module (#765)
* More precise errors in the nodes module

* Typo

* Prove the panics
2018-12-11 15:36:41 +01:00
Toralf Wittner
a152e18821
Simplify handling of upgrade information. (#761) 2018-12-11 15:13:10 +01:00
Pierre Krieger
2dce4294a0
Add version numbers in the deps in Cargo.toml (#768) 2018-12-11 14:54:44 +01:00
Pierre Krieger
581778ba92
Move the transport timeout to libp2p_core (#764) 2018-12-11 10:56:24 +01:00
Pierre Krieger
d06eb67353
Add a mDNS network behaviour (#736)
* Move the MdnsService to a service module

* Add a Mdns behaviour

* Add a Mdns network behaviour

* Add minor documentation

* Add minor todo

* Use nat_traversal on the observed address

* Don't add self to topology

* Automatically connect to nodes we discover

* Add Debug implementations

* Fix example
2018-12-10 16:00:16 +01:00
Pierre Krieger
a8a6438fbc
Rename libp2p-tcp-transport to libp2p-tcp (#762) 2018-12-10 13:39:11 +01:00
Pierre Krieger
d94a768bd9
Rename multiaddr and mulithash to parity-* (#737)
* Rename multiaddr and mulithash to parity-*

* Fix doctests
2018-12-07 15:40:02 +01:00
Pierre Krieger
8d8fc75a4e
Add a dial priority system (#753) 2018-12-07 14:43:51 +01:00
Toralf Wittner
dd5fb17a2b
Rename OrUpgrade to SelectUpgrade. (#751)
Also remove `InboundUpgrade.or_inbound` and `OutboundUpgrade.or_outbound`.
2018-12-07 11:39:18 +01:00
Pierre Krieger
2ef4d779ca
Add metadata to all the Cargo.toml (#743) 2018-12-06 19:22:06 +01:00
James Ray
b2367e59ce Add error messages for interrupt (#704)
* Add error messages for interrupt

* Change to use enum InterruptErr

* Add a clarification for Connected variant.

* Grammar fix

* CollectionStream.interrupt() -> interrupt()

* Implement suggestions

* Fix: Error and Display as traits

* Update used variants

* Update core/src/nodes/collection.rs

Co-Authored-By: jamesray1 <16969914+jamesray1@users.noreply.github.com>

* Add Display and Error impls

* Adjust interrupting_an_established_connection_is_err test

* Update interrupting_a_connection_attempt_twice_is_err

* Remove a blank line

* use assert_matches!

* Remove PartialEq

* Remove source from impl:Error
2018-12-05 14:47:06 +01:00
Pierre Krieger
57ebe697b5
Don't add an address to the topology if it is already in (#724)
* Don't add an address to the topology if it is already in

* Update core/src/topology/mod.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
2018-12-04 14:05:05 +01:00
Pierre Krieger
10d76d64d0
Add a few more methods to Swarm and PollParameters (#721) 2018-12-04 13:54:04 +01:00
Toralf Wittner
acfa1c9c79
Remove some boxed futures. (#718) 2018-12-04 11:24:59 +01:00
Toralf Wittner
a5766fdfac
Fix several errors reported by clippy. (#715) 2018-12-04 11:12:49 +01:00
Pierre Krieger
c5d08ab48c
Enhance the swarm a bit (#711)
* Replace the &mut TTopology with a &mut PollParameters

* Add supported_protocols

* Add external_addresses

* Report out addresses in Kademlia

* Fix the custom derive

* Some comments

* Fix compilation on stable
2018-12-01 13:34:57 +01:00
David
b269d6184e Use UpgradeError::into_io_error (#709)
* Use UpgradeError::into_io_error

* Update core/src/transport/upgrade.rs

Co-Authored-By: dvdplm <dvdplm@gmail.com>

* Update core/src/transport/upgrade.rs

Co-Authored-By: dvdplm <dvdplm@gmail.com>
2018-11-30 08:34:04 +01:00
Pierre Krieger
090ecb88e4
Revamp the documentation of the root of core (#684)
* Revamp the documentation of the root of core

* Update core/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Update core/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Update core/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Update core/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Update core/src/lib.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Fix more concerns

* Merge into one
2018-11-29 21:22:24 +01:00
James Ray
fceaf2293b Chore/grammar (#701)
* Add a space.

* qed -> QED and ' ; qed' -> '; QED'

* ' ; QED' -> '; QED'
2018-11-29 16:38:52 +01:00
Pierre Krieger
3aa1fcbdc6
Add a KademliaHandler (#580)
* Rework Kademlia for the new design

* Minor work on protocol.rs

* More work

* Remove QueryTarget::FindValue

* Finish work on query

* Query timeout test

* Work on topology

* More work

* Update protocols/kad/src/topology.rs

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>

* Fix trailing whitespaces

* Use if let
2018-11-29 12:11:35 +01:00
James Ray
ab192cdca7 Add 'of' (#700) 2018-11-29 10:57:06 +01:00
James Ray
3556ffde5d Fix a typo and grammar and add a clarification. (#688)
* Fix a typo and grammar and add a clarification.

* Update core/src/nodes/handled_node_tasks.rs

Co-Authored-By: jamesray1 <16969914+jamesray1@users.noreply.github.com>
2018-11-28 11:13:00 +01:00
Pierre Krieger
6cde480c29
Fix Transport::and_then (#690) 2018-11-27 19:13:34 +01:00