2425 Commits

Author SHA1 Message Date
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
Pierre Krieger
f8ccb0af36
Rewrite floodsub to use the ProtocolsHandler (#603)
* Move lib.rs to protocol.rs

* Rewrite floodsub for ProtocolsHandler

* Add a FloodsubBehaviour

* Fix closing floodsub after a message

* Address concern

* Make it conform to the protocol

* Make it really conformant

* Address concerns
2018-11-13 14:46:57 +01:00
Pierre Krieger
b3b5a4bdfd
Add an IdentifyListen behaviour (#626)
* Add an IdentifyListen behaviour

* Use infos() and infos_mut() instead
2018-11-12 17:23:20 +01:00
Pierre Krieger
623728b35d
Add a custom derive for NetworkBehaviour (#619)
* Add ProtocolsHandlerSelect

* Add a custom derive for NetworkBehaviour

* Remove 2018 edition

* More work

* Update the tests and work

* Allow ignored fields

* More fixes

* Give access to everything in the poll method
2018-11-12 17:12:47 +01:00
David
7268a5ab13 Set the maximum size of Mplex messages to 1Mb (#622)
* Set the maximum size of Mplex messages to 1Mb

* address grumble

* Maximum size is not arbitrary

* Maximum packet size is in the spec
2018-11-12 14:57:30 +01:00
David
8595219db1 Use expect rather than unwrap (#625) 2018-11-12 13:34:02 +01:00
Pierre Krieger
38b5841801
Make libp2p-websocket optional (#624) 2018-11-12 11:42:42 +01:00
Pierre Krieger
6a7c722ffc Add From<IpAddr> for Multiaddr (#623) 2018-11-12 10:44:18 +01:00
Pierre Krieger
a3b0914d73
Add implementations of NetworkBehaviour for ping (#618)
* Add implementations of NetworkBehaviour for ping

* Grumbles
2018-11-09 17:05:53 +01:00
Pierre Krieger
52ce49da95
Add a PeriodicIdentifyBehaviour (#617) 2018-11-09 16:51:07 +01:00
David
3e1eca16d7 Use upstream rust-secp256k1 (#616) 2018-11-09 15:02:27 +01:00
Toralf Wittner
981e7b1cc8 Use yamux and aio-limited from crates.io (#621)
Addresses #593.
2018-11-09 14:52:55 +01:00
David
d961e656a7 Use vecdeque for fair polling (#610)
* WIP

* Use pop_back()
Improve tests

* Avoid unwrapping

* Update core/src/nodes/listeners.rs

Co-Authored-By: dvdplm <dvdplm@gmail.com>
2018-11-08 14:55:54 +01:00
Pierre Krieger
c04d0fe797
Add back the Swarm (#613) 2018-11-07 19:29:07 +01:00
Pierre Krieger
8377a2f50d
Remove dependency on tokio_current_thread (#606) 2018-11-07 18:30:21 +01:00
David
c3a92472bb Use chashmap from crates (#615) 2018-11-07 18:14:47 +01:00
James Ray
61f280f3ef Fix grammar in core/nodes etc. (#608)
* Fix grammar

* Nothing we can *do* except ...

* Implementer

* Implementation
2018-11-07 17:01:33 +01:00
Pierre Krieger
1b4dada4d0
Inject event by value in ProtocolsHandler (#605) 2018-11-05 16:53:04 +01:00
Pierre Krieger
4405518045
Add a PeriodicPingHandler and a PingListenHandler (#574)
* Add ProtocolsHandler trait

* Reexport symbols

* Add a note about shutting down

* Add a PeriodicPingHandler and a PingListenHandler

* Fix core doctest

* Add tolerating not supported

* Fix concerns
2018-11-04 09:47:15 +01:00
Pierre Krieger
631ceaea4b
Fix stack overflow when printing a SubstreamRef (#599)
* Fix stack overflow when printing a SubstreamRef

* Fix concern

* More problems
2018-11-03 09:54:31 +01:00
Pierre Krieger
fc63947e7b
Add a peer id generator (#583)
* Add a peer id generator

* Improve usage message

* Better help

* Rustfmt
2018-11-02 16:49:28 +01:00
James Ray
0f3ef5ee0a eg. -> e.g.; ie. -> i.e. via repren (#592)
* eg. -> e.g.; ie. -> i.e. via repren

* se.g. -> seg.
2018-11-02 16:40:00 +01:00
Pierre Krieger
4225d2631b
Add a IdentifyTransport (#569)
* Add a IdentifyTransport

* Retreiver -> Retriever

* Move the muxer in the IdRetrieverState
2018-11-02 14:23:38 +01:00
David
437a8c0fde Tests for HandledNode (#546)
* 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

* Move Handler related code to dummy_handler

* Fixes broken test after upstream changes

* Clarify the behaviour of is_shutting_down

* Fix broken test

* Fix tests after recent changes on master

* no tabs

* whitespace

* rustfmt

* Add public HandledNode.handler() method that returns a ref to the NodeHandler
Don't use private members in tests

* Add HandledNode.handler_mut that returns a mutable ref to the NodeHandler

* Remove debugging stmts

* Fix parse error
2018-11-02 14:12:21 +01:00
Pierre Krieger
9249e31218
Some minor fixes reported by clippy (#600) 2018-11-02 13:15:17 +01:00
Pierre Krieger
9d91217193
Add a PeriodicIdentification protocol handler (#579)
* Add ProtocolsHandler trait

* Reexport symbols

* Add a note about shutting down

* Add a PeriodicIdentification protocol handler
2018-11-02 10:06:59 +01:00
Pierre Krieger
c730b4b3c9
Add ProtocolsHandler trait (#573)
* Add ProtocolsHandler trait

* Reexport symbols

* Add a note about shutting down

* Add map_protocol

* Add a NodeHandlerWrapperBuilder

* Update core/src/nodes/protocols_handler.rs

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

* Fix compilation
2018-11-01 11:06:32 +01:00
Pierre Krieger
4627f21180
Use paritytech/rust-secp256k1 (#598) 2018-10-31 11:17:12 +01:00
Pierre Krieger
61acb7c13f
Use websocket 0.21.0 (#597) 2018-10-31 09:55:59 +01:00
Pierre Krieger
29b1b0b3ba
Reexport multihash from the facade (#587) 2018-10-31 08:31:15 +01:00
Chevdor
7c8d8b5096 Add substrate to the list of projects using libp2p (#595) 2018-10-30 10:48:24 +01:00