1345 Commits

Author SHA1 Message Date
Pierre Krieger
a9eefe1015
Remove notifying tasks (#528) 2018-10-01 11:18:00 +02:00
Pierre Krieger
895557cb82
Fix handler not properly shut down, and write test for this (#514)
* Fix handler not properly shut down, and write test

* Remove to_notify from the test
2018-10-01 11:17:34 +02:00
Eyal Kalderon
ad0807b3f3 Use unsigned-varints, add BLAKE2 support in multihash (#525)
* Add support for unsigned varints

* Depend on unsigned-varint 0.2 without default features

* Change hash code type from u8 to u64

* Fix hash codes and enum variants for BLAKE2 to fit the standard (see #524)

* Run cargo fmt on crate

* Expand hash_types test to include all variants

* Add support for BLAKE2b-512 and BLAKE2s-256

* Depend on blake2 crate 0.7 with no default features

* Update encode! macro for support for blake2 crate

* Update all tests to include BLAKE2b-512 and BLAKE2s-256

* Reduce hash code size from u64 to u16

* Fix typo in doc comment

* Bump tiny-keccak to version 1.4

* Remove unnecessary default-features = false in Cargo.toml
2018-10-01 09:58:11 +02:00
Qian LinFeng
4fa680e282 Upgrade smallvec version to fix license issue (#526) 2018-09-30 16:18:19 +02:00
James Ray
bf066773e3 ybsubscribing -> unsubscribing (#513) 2018-09-24 09:32:20 +02:00
Pierre Krieger
ee9ff643a5
Split collection.rs in two (#507)
* Split collection.rs in two

* Fix forgot to interrupt inner task

* Another fix in collection.rs

* More qed
2018-09-21 17:31:52 +02:00
Pierre Krieger
4fe92f81e8
Fix logic error in public key mismatch (#510) 2018-09-21 17:11:27 +02:00
Toralf Wittner
b61d9faece
multiaddr: future-proof error type (#506) 2018-09-21 10:39:36 +02:00
Toralf Wittner
3f3d81cc95
Map AsyncWrite::shutdown to Sink::close. (#505) 2018-09-21 10:10:45 +02:00
Pierre Krieger
a988926c3e
Fix the ping dialer never closed (#504)
* Fix the ping dialer never closed

* Fix not ready
2018-09-21 10:06:04 +02:00
Pierre Krieger
a910797f22
Fix invalid state after peer id mismatch (#503) 2018-09-21 09:32:23 +02:00
Pierre Krieger
4d8da24c64
Fix the Default implementation of Ping (#501) 2018-09-20 19:53:31 +02:00
Toralf Wittner
84b089cacc
Refactor multiaddr crate. (#498)
Refactor multiaddr crate.

- Remove `AddrComponent`. Instead `Protocol` directly contains its
associated data.

- Various smaller changes around conversions to Multiaddr from other
types, e.g. socket addresses.

- Expand tests to include property tests which test encoding/decoding
identity.
2018-09-20 19:51:00 +02:00
Pierre Krieger
1969bde4fe
Rework the Ping protocol (#497)
* Rework the Ping upgrade

* Fix concerns
2018-09-20 16:55:57 +02:00
Pierre Krieger
f2a5eee5e8
Add a NodeHandler trait (#495)
* Add a NodeHandler trait

* Fix compilation

* Some fixes
2018-09-19 16:33:29 +02:00
Toralf Wittner
7fb09fbf20
secio: keep ciphertext if start_send is not ready (#494)
* secio: keep ciphertext if start_send is not ready

Otherwise ciphertext may be thrown away and once sent, the cipher states
have diverged, resulting in nonsense messages on decryption side.

* Also attempt to send pending data `Sink::close`.

* Inline `send_pending`.
2018-09-18 22:51:13 +02:00
Pierre Krieger
8cf17f49e1
Add a basic test to listeners (#489) 2018-09-18 15:56:29 +02:00
Pierre Krieger
783522f54c
Prove the panics (#491) 2018-09-17 17:15:27 +02:00
Pierre Krieger
0c43c76965
Implement close() from Sink (#492) 2018-09-17 15:01:37 +02:00
Pierre Krieger
3e53a9dcc7
Fix additional addresses not tried (#483)
* Fix additional addresses not tried

* More fixes

* Produce a dialing error if unsupported multiaddr
2018-09-17 10:30:10 +02:00
Pierre Krieger
d719ac6037
Revert "Revert "remove rustc-serialize (#359) (#386)" (#466)" (#477)
This reverts commit 0a3d4cdfade1656d72ca99751e94e179bdaec221.
2018-09-17 10:05:37 +02:00
Pierre Krieger
2a7a48b496
Fix old task not interrupted after replacing (#482) 2018-09-14 20:40:28 +02:00
Pierre Krieger
063ab178a9
Add an alternative to the swarm (#472)
* Rewrite the swarm

* Small improvement to Debug of ListenersStream

* Fix Swarm::Replaced never being produced

* Fix logic problem when reaching a node in swarm

* Small comment in swarm

* Add closed_multiaddr to Replaced event

* Add address to NodeClosed and NodeError

* Fix concerns

* Remove StreamMuxer::boxed
2018-09-14 13:18:10 +02:00
Toralf Wittner
0614b0d44e
secio: don't panic in agree_ephemeral. (#480)
Given that echoing back our local key and nonce would result in equal
digest values, we should treat this as an error instead of panicking.
2018-09-14 11:37:40 +02:00
Toralf Wittner
b2756c8fa9
Make Multiaddr::iter borrow data (#478)
* Use `unsigned-varint` crate.

* Implement `Display` for `Protocol`.

Gives `ToString` for free.

* Use `Cow` in `AddrComponent`.

* Add `AddrComponent::acquire`.

* Document `AddrComponent::acquire`.
2018-09-14 10:21:14 +02:00
Arkadiy Paronyan
5980a4538e
Secp256k1 key generation (#474) 2018-09-13 10:26:52 +02:00
Toralf Wittner
6a5681aed7
secio: Add NULL cipher and allow more configuration. (#468)
* Introduce NULL cipher and allow more configuration.

* Back to using the hash-code for handshake.

Using `Endpoint` would be incompatible with the existing protocol.

* Add comments.
2018-09-12 09:10:05 +02:00
Pierre Krieger
5ecdb71c29
Populate TcpConfig with more config (#454) 2018-09-11 12:04:35 +02:00
Pierre Krieger
fd4b7488be
Add some comments about the notification behaviour of muxers (#453) 2018-09-11 11:17:44 +02:00
Toralf Wittner
cfdfca1a06
Similar to #469, consider endpoint while retaining. (#470) 2018-09-10 14:03:38 +02:00
Toralf Wittner
ec6ec92a79
mplex: fix destroy_substream (#469)
Retain all incoming buffer elements with different substream ID or equal
Endpoint. The latter was previously not considered which could result in
the removal of data for another substream with same ID but opposite
Endpoint.
2018-09-10 10:21:19 +02:00
Pierre Krieger
304e9c72c8
Report the entire peers after a result (#467) 2018-09-07 16:46:34 +02:00
Pierre Krieger
0a3d4cdfad
Revert "remove rustc-serialize (#359) (#386)" (#466)
This reverts commit 73996885cb2d645ee91361204c33e7039290aabc.
2018-09-07 14:05:42 +02:00
Pierre Krieger
e45dce2d9a
Switch to twofish by default (#465) 2018-09-06 17:35:25 +02:00
Pierre Krieger
381c071cbc
Add BoxedMuxed transport (#459)
* Add BoxedMuxed transport

* Extend to both muxed and non-muxed versions

* Style

* Implement Debug for boxed transports
2018-09-06 16:59:47 +02:00
Pierre Krieger
601de6ab70
Minor fix for concat_comma (#464) 2018-09-06 16:31:15 +02:00
Pierre Krieger
bccd710fb4
Limit upload frame sizes to 1024 in mplex (#462) 2018-09-06 15:43:49 +02:00
Toralf Wittner
5c35047ee3 Change stream ID handling to consider flags. (#436)
Replaces the former odd/even distinction of IDs. However we still increment stream IDs by 2
for backwards compatibility.
2018-09-06 13:59:14 +02:00
Pierre Krieger
ea1f172397
Implement Send everywhere (#458) 2018-09-06 09:54:35 +02:00
Pierre Krieger
bca1083d9c
Make the Futures in map_err Send-friendly (#418)
* Make the Futures in map_err Send-friendly

* Address concern
2018-09-05 09:09:32 +02:00
Pierre Krieger
e2960b4317
Add support for twofish cipher (#457) 2018-09-05 02:15:16 +02:00
Pierre Krieger
ba4bd79fd9
Fix mplex notifications system (#455)
* Fix mplex notifications system

* Some fixes
2018-09-05 01:53:39 +02:00
Toralf Wittner
a6c82e6ca1
Use Bytes instead of BytesMut in mplex. (#456) 2018-09-04 16:12:58 +02:00
Pierre Krieger
75ceba7809
The SwarmFuture is now a Stream (#442)
* The SwarmFuture is now a Stream

* Return the produced future in the message

* Remove IncomingConnection event

* Pass error when failing to dial

* Fix loop break mistake

* Fix concern

* Rename SwarmFuture to SwarmEvents

* Increase type length limit

* Remove todo
2018-09-04 14:53:27 +02:00
Guanqun Lu
ee9be6f0c9 add must_use for Future (#450) 2018-09-04 12:30:57 +02:00
Pierre Krieger
02576eecf1
Downgrade ring to 0.12 (#448) 2018-09-03 20:44:55 +02:00
Pierre Krieger
5f0347a8b7
Cap the allocated buffer capacity in mplx (#449) 2018-09-03 18:33:51 +02:00
Toralf Wittner
cd1d81b5d0
Update unsigned-varint crate to v0.2.0 (#447) 2018-09-03 17:19:03 +02:00
Pierre Krieger
f787c80a42 Merge the changes from polkadot-2 into master (#446) 2018-09-03 16:46:15 +02:00
Pierre Krieger
35e005879b
Simplify the mplex codec implementation (#445) 2018-09-03 15:41:36 +02:00