605 Commits

Author SHA1 Message Date
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
Pierre Krieger
179e65ff5c
Fix core-derive (#707) 2018-11-29 18:01:16 +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
Pierre Krieger
6e1e256fe1
Add a warning about being conformant (#693) 2018-11-28 19:10:04 +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
Pierre Krieger
e12795d1e6
Fix the custom derive (#689)
* Fix the custom derive

* Concern
2018-11-27 16:10:34 +01:00
Pierre Krieger
45114aef46
Move the Swarm in its own module (#681) 2018-11-27 11:22:55 +01:00
Pierre Krieger
95ebee5841
Update some dependencies (#686)
* Update many dependencies

* Upgrade some secio deps
2018-11-27 10:35:47 +01:00
Toralf Wittner
d7ac755773
Avoid boxing in transport combinators. (#671)
Also use `ConnectedPoint` instead of `Endpoint` as parameter for mapping
function to align with `transport::and_then`.
2018-11-26 15:12:48 +01:00
Pierre Krieger
dc55b00730
Split the protocols_handler.rs module into multiple submodules (#680)
* Rename protocols_handler.rs to protocols_handler/mod.rs

* Move DummyProtocolsHandler out of the module

* Extract ProtocolsHandlerSelect

* Extract NodeHandlerWrapper
2018-11-26 14:01:08 +01:00
Toralf Wittner
d130302e15
Remove several unused transports. (#673) 2018-11-26 13:46:34 +01:00
Toralf Wittner
f833c5d9ff
rw-stream-sink: Add regression test. (#683)
Closes #679.
2018-11-26 13:36:47 +01:00
David
9fe7d56410 Tests for RawSwarm (#602)
* Add unit tests for core::nodes::NodeStream

* Move DummyMuxer to core/tests

* Address grumbles

* Impl Debug for SubstreamRef<P>

* Add test for poll()

* Don't need to open a substream

* pretty printer test

* More tests for NodeStream poll()

* ListenerStream unit tests: transport() and listeners()

* Tests for nodes/listeners.rs

* Add a few tests to help illustrate the "drowning" behaviour of busy listeners

* Tests for HandledNode

* Address grumbles

* Remove non-project specific stuff

* Address grumbles

* Prefer freestanding function

* Untangle the code for old shutdown test from the new tests
Add HandlerState and use it in TestBuilder
Shorter test names

* WIP – tests pass

* Use a newtype to lighten up the function signatures a bit
Test NotReady case

* Cleanup Event enum
Track events as they reach the Handler
Describe complex test logic

* Assert on the event trace

* More tests for poll()

* Switch to using usize as the OutboundOpenInfo so we can assert on event contents
More tests for poll()

* whitespace

* whitespace and spelling

* WIP tests for handled_node_tasks:Task

* wip

* Move Handler related code to dummy_handler

* Sort out the events going to/from node

* WIP tests for poll

* Add a TestBuilder for NodeTask tests
More NodeTask tests

* Fixes broken test after upstream changes

* Clarify the behaviour of is_shutting_down

* Fix broken test

* Test for task exit when muxers in- and outbound are closed

* Add question about impossible Async::NotReady

* Fix tests after recent changes on master

* Upstream changes

* Tests for HandledNodesTasks

* Add test for HandledNodesTasks poll

* Test we reach all nodes and then closed all nodes

* Test event emission by HandledNodesTasks

* Test starting CollectionStream

* Test that we can reach a peer after a successful connection

* Assert collection contains what we expect

* Test handler events get to the collectionstream

* Remaining tests for CollectionStream

* Run tests on single threaded runtime to avoid intermittent failures

* Remove call to shutdown – not needed

* No need to specify tokio version

* Change the DummyTransport Output type to match RawSwarm

* First few tests for RawSwarm
Whitespace: spaces

* Dummy impl of `dial()`

* Typos/grammar in docs

* Impl Debug for RawSwarmEvent and Peer
Test dialing peer without peer id

* Test num_incoming_negotiated

* A few more tests

* whitespace

* Add derive(Debug) for RawSwarm, ReachAttempts, PeerPendingConnect, PeerNotConnected
Fix intermittent test failures by polling repeatedly when getting NotReady
Add more tests

* Outline remaining work

* Test more error conditions

* wip

* Test error conditions

* Remove debug statements

* typo

* whitespace

* Use PeerId::random

* Uneeded dependency

* Use PeerId::random

* Somewhat less artificial nat_traversal test

* Use the IPv6 "black hole" prefix as an "unreachable" multiaddr

* Use a boolean on DummyTransport to make dial attempts fail

* No funny stuff for nat_traversal
2018-11-26 08:57:19 +01:00
Pierre Krieger
1b05132d6a
Add libp2p-mdns (#590)
* Add libp2p-mdns

* Fix win32

* Make compatible with Rust 1.29

* Remove mDNS on esmcripten

* Fix concerns

* More concern

* Use append_u16

* Make decode_character_string return a Cow

* Add TODO

* Don't send queries from 5353

* Fix flags

* More flags fix

* More concerns

* Fix flags

* Fix removed env_logger
2018-11-24 13:55:18 +01:00
David Dias
7bf723ae50 docs: add libp2p badges (#676)
* docs: add libp2p badges

* docs: remove waffle, move all badges to the same line
2018-11-24 13:39:13 +01:00
Toralf Wittner
826a290bf1
examples: Use logger in chat example. (#678) 2018-11-23 14:18:30 +01:00
Toralf Wittner
aa86f6824d
rw-stream-sink: Skip over empty stream items. (#677)
Otherwise it may report the reading of 0 bytes which is interpreted as
EOF by consumers of `std::io::Read::read`.
2018-11-23 13:54:17 +01:00
Pierre Krieger
1da97242da
Remove the NamesIter: Clone requirement (#663)
* Remove the NamesIter: Clone requirement

* Fix concerns
2018-11-22 18:15:35 +01:00
Pierre Krieger
177c6cf842
Remove _priv from IdentifyInfo (#669) 2018-11-22 14:36:48 +01:00
David
2ec991bb66 Export plaintext from the root (#665) 2018-11-21 13:59:41 +01:00
Toralf Wittner
a5fee2dbac
secio: Defer nonce verification. (#667) 2018-11-21 10:39:48 +01:00
David
31962f5920 A few typos (#666) 2018-11-20 21:31:09 +01:00
Toralf Wittner
938b91742f
Add EitherUpgrade and generalise OrUpgrade. (#662) 2018-11-20 15:09:59 +01:00
Pierre Krieger
b213fd7bd7
Add PeerId::random() (#661) 2018-11-20 13:44:36 +01:00
David
080a75451f Floodsub chat example (#641)
* Add a floodsub example with the new Swarm

* WIP fixes for Floodsub chat-example code

* cleanup

* Address grumbles

* Update docs

* Update to newest master
2018-11-20 10:35:22 +01:00
Pierre Krieger
afa54085d5
Remove trivial todo (#657) 2018-11-19 22:28:48 +01:00
Toralf Wittner
64af676178
Fix mapping of upgrade errors. (#656)
The current implementation of `MapUpgradeErr` implements `InboundUpgrade`
and `OutboundUpgrade` and applies the transformation in both cases which
means that mapping is always applied to inbound and outbound upgrade
errors. This commit uses separate `MapInboundUpgradeErr` and
`MapOutboundUpgradeErr` types which implements both traits but only map
errors in one direction.
2018-11-19 16:08:00 +01:00
Toralf Wittner
e7bffd009f
Add upgrade::apply for convenience. (#653) 2018-11-19 15:19:07 +01:00
Toralf Wittner
1d1970c772
Fix mapping of upgrade. (#654)
The current implementation of `MapUpgrade` implements `InboundUpgrade`
and `OutboundUpgrade` and applies the transformation in both cases which
means that mapping is always applied to inbound and outbound upgrades.
This commit uses separate `MapInboundUpgrade` and `MapOutboundUpgrade`
types which implements both traits but only map in one direction.
2018-11-19 10:58:45 +01:00
Pierre Krieger
2c1807b646
Remove Send/Sync/'static requirements in identify (#649) 2018-11-16 13:59:56 +01:00
Pierre Krieger
37994b34e7
Behavior -> Behaviour (#650) 2018-11-16 12:59:57 +01:00
Pierre Krieger
23bcd44f18
Remove Send/Sync/'static reqs from ping (#652) 2018-11-16 12:49:55 +01:00
David
8b6bdd5554 Tests for CollectionStream (#588)
* Add unit tests for core::nodes::NodeStream

* Move DummyMuxer to core/tests

* Address grumbles

* Impl Debug for SubstreamRef<P>

* Add test for poll()

* Don't need to open a substream

* pretty printer test

* More tests for NodeStream poll()

* ListenerStream unit tests: transport() and listeners()

* Tests for nodes/listeners.rs

* Add a few tests to help illustrate the "drowning" behaviour of busy listeners

* Tests for HandledNode

* Address grumbles

* Remove non-project specific stuff

* Address grumbles

* Prefer freestanding function

* Untangle the code for old shutdown test from the new tests
Add HandlerState and use it in TestBuilder
Shorter test names

* WIP – tests pass

* Use a newtype to lighten up the function signatures a bit
Test NotReady case

* Cleanup Event enum
Track events as they reach the Handler
Describe complex test logic

* Assert on the event trace

* More tests for poll()

* Switch to using usize as the OutboundOpenInfo so we can assert on event contents
More tests for poll()

* whitespace

* whitespace and spelling

* WIP tests for handled_node_tasks:Task

* wip

* Move Handler related code to dummy_handler

* Sort out the events going to/from node

* WIP tests for poll

* Add a TestBuilder for NodeTask tests
More NodeTask tests

* Fixes broken test after upstream changes

* Clarify the behaviour of is_shutting_down

* Fix broken test

* Test for task exit when muxers in- and outbound are closed

* Add question about impossible Async::NotReady

* Fix tests after recent changes on master

* Upstream changes

* Tests for HandledNodesTasks

* Add test for HandledNodesTasks poll

* Test we reach all nodes and then closed all nodes

* Test event emission by HandledNodesTasks

* Test starting CollectionStream

* Test that we can reach a peer after a successful connection

* Assert collection contains what we expect

* Test handler events get to the collectionstream

* Remaining tests for CollectionStream

* Run tests on single threaded runtime to avoid intermittent failures

* Remove call to shutdown – not needed

* No need to specify tokio version

* Rustfmt

* More rustfmt

* Less noise

* cleanup

* Address grumbles

* Better debug impl for HandledNodesTasks

* Remove tests for Task we don't need
Test Task.send_event() and id() using a HandledNodesTasks

* Rename test builders

* Don't organise tests in submodules

* whitespace

* Revert changes to Debug impl for HandledNodesTasks

* Cleanup

* cleanup

* Address concerns

* Fix tests
2018-11-16 12:38:23 +01:00
Pierre Krieger
413fb79208
Document the muxing module (#647)
* Document the muxing module

* Apply suggestions from code review

Co-Authored-By: tomaka <pierre.krieger1708@gmail.com>
2018-11-16 12:24:12 +01:00
Pierre Krieger
146817d7d9
Document the core::upgrade module (#644)
* Document the upgrade module

* Apply suggestions from code review

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

* More fixes
2018-11-16 12:11:44 +01:00
David
2004b196e2 Send Close when shutting down gracefully, as per spec (#631) 2018-11-16 11:35:57 +01:00
Pierre Krieger
373b05347a
Remove the Send + 'static requirements for floodsub (#637) 2018-11-15 19:00:57 +01:00
Pierre Krieger
1c9091655b
Move protocols_handler to the root (#643) 2018-11-15 18:39:20 +01:00
Pierre Krieger
ded89b4be3
Use a random sequence number in floodsub (#634)
* Use a random sequence number in floodsub

* Comment
2018-11-15 18:03:09 +01:00
Toralf Wittner
2e549884ef Split ConnectionUpgrade. (#642)
Introduce `InboundUpgrade` and `OutboundUpgrade`.
2018-11-15 17:41:11 +01:00
James Ray
466385a58a Add an impl Debug for HandledNode (#628)
* Add an impl Debug for HandledNode

* Update core/src/nodes/handled_node.rs

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

* Update core/src/nodes/handled_node.rs

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

* Update core/src/nodes/handled_node.rs

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

* Update core/src/nodes/handled_node.rs

Co-Authored-By: jamesray1 <16969914+jamesray1@users.noreply.github.com>
2018-11-15 11:22:45 +01:00
isan_rivkin
0eef1948e5 minor typo in docs (#640) 2018-11-15 11:06:58 +01:00
David
37e2ec38a7 Update connected peers' topics on NodeEvent (#638)
* Update connected peers' topics on NodeEvent

After a peer connects they send us the list of the topics they're subscribed to. This causes a NodeEvent to be emitted. This PR makes sure we update the subscription info we have on the newly connected peer.

* Formatting

* Update protocols/floodsub/src/layer.rs

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

* whiespace
2018-11-14 22:03:00 +01:00
Pierre Krieger
24ccefbbc6
Fix the concerns of #603 (#635) 2018-11-14 14:07:54 +01:00
David
513b97b015 Tests for HandledNodesTasks (#584)
* Add unit tests for core::nodes::NodeStream

* Move DummyMuxer to core/tests

* Address grumbles

* Impl Debug for SubstreamRef<P>

* Add test for poll()

* Don't need to open a substream

* pretty printer test

* More tests for NodeStream poll()

* ListenerStream unit tests: transport() and listeners()

* Tests for nodes/listeners.rs

* Add a few tests to help illustrate the "drowning" behaviour of busy listeners

* Tests for HandledNode

* Address grumbles

* Remove non-project specific stuff

* Address grumbles

* Prefer freestanding function

* Untangle the code for old shutdown test from the new tests
Add HandlerState and use it in TestBuilder
Shorter test names

* WIP – tests pass

* Use a newtype to lighten up the function signatures a bit
Test NotReady case

* Cleanup Event enum
Track events as they reach the Handler
Describe complex test logic

* Assert on the event trace

* More tests for poll()

* Switch to using usize as the OutboundOpenInfo so we can assert on event contents
More tests for poll()

* whitespace

* whitespace and spelling

* WIP tests for handled_node_tasks:Task

* wip

* Move Handler related code to dummy_handler

* Sort out the events going to/from node

* WIP tests for poll

* Add a TestBuilder for NodeTask tests
More NodeTask tests

* Fixes broken test after upstream changes

* Clarify the behaviour of is_shutting_down

* Fix broken test

* Test for task exit when muxers in- and outbound are closed

* Add question about impossible Async::NotReady

* Fix tests after recent changes on master

* Upstream changes

* Tests for HandledNodesTasks

* Add test for HandledNodesTasks poll

* Test we reach all nodes and then closed all nodes

* Test event emission by HandledNodesTasks

* Rustfmt

* More rustfmt

* Less noise

* cleanup

* Address grumbles

* Better debug impl for HandledNodesTasks

* Remove tests for Task we don't need
Test Task.send_event() and id() using a HandledNodesTasks

* Rename test builders

* Don't organise tests in submodules

* whitespace

* Revert changes to Debug impl for HandledNodesTasks
2018-11-14 11:51:38 +01:00
David
9b47dd5385 Tweaks, spelling and grammar (#629) 2018-11-13 21:29:33 +01:00
Pierre Krieger
576538b67d
Add a badge with a link to deps.rs (#630) 2018-11-13 19:47:28 +01:00