Commit Graph

1009 Commits

Author SHA1 Message Date
073f073a77 Backport #1347 to master 2019-12-11 17:07:16 +01:00
3f1cbaa3a8 Fix noise/io.rs not flushing the underlying stream 2019-12-11 17:02:32 +01:00
08568a4696 Merge pull request #1346 from tomaka/patch-mselect
Publish multistream-select 0.6.1
2019-12-11 14:04:06 +01:00
22c2a4f09b Publish multistream-select 0.6.1 2019-12-11 13:04:17 +01:00
18bcba94e7 Err, fix wrong foo functions 2019-12-10 17:22:40 +01:00
213c633b92 Pass &mut std::task::Context to poll 2019-12-10 16:54:38 +01:00
d738f4158f More work 2019-12-10 13:40:40 +01:00
ad42b00981 Cleanups in libp2p-core in stable-futures branch 2019-12-10 12:12:34 +01:00
7e9175716e Merge pull request #1340 from romanb/stable-futures-multistream-simpl
[stable-futures] Remove a write optimisation in Negotiated.
2019-12-10 11:29:10 +01:00
7745bfd01f Merge pull request #1338 from romanb/multistream-select-io-fix
Fix possible incorrect return value from <LengthDelimitedReader as io::Write>::write().
2019-12-10 11:29:05 +01:00
a8a0c4340a Update Cargo.toml
upgrade ed25519-dalek
2019-12-10 13:37:23 +09:00
1e8a90c606 Remove a write optimisation in Negotiated. 2019-12-09 21:13:55 +01:00
e4f46aed06 Simplify and update test.
Remove the optimisation of writing data out together with any
remaining buffer for simplicity.
2019-12-09 17:51:55 +01:00
a5415f9e1d Merge pull request #1339 from tomaka/ignore-kad-fail
Make the kademlia test ignore failures
2019-12-09 17:13:09 +01:00
26ec67b0a9 Make the kademlia test ignore failures 2019-12-09 16:50:08 +01:00
481849e4f1 secio: Back to 4-byte BE length prefix. (#1337)
The secio spec states that each frame must be prefix with a 32-bit big
endian length prefix so we can not use an unsigned varint here.
2019-12-09 16:34:13 +01:00
3de85ba4e2 Fix possible incorrect return value from LengthDelimitedReader::write().
Due to not taking into account buf.len() when computing `written`,
it may be incorrectly less than buf.len().
2019-12-09 15:50:35 +01:00
b6d5d97261 Merge pull request #1336 from tomaka/fix-stable-fut-tests
Fix the regular tests for stable-futures
2019-12-09 12:06:15 +01:00
73e745ec2b Fix the regular tests for stable-futures 2019-12-09 11:41:31 +01:00
ea58aed37e Merge pull request #1335 from twittner/tests
Fix remaining tests.
2019-12-09 11:37:37 +01:00
173fc04b30 Fix tests. 2019-12-07 15:11:46 +01:00
9cefb52b1f Update to current soketto develop. (#1332) 2019-12-06 15:54:15 +01:00
fb997f24da Merge pull request #1327 from tomaka/merge-master-for-real
Merge master for real
2019-11-29 17:54:21 +01:00
a6bef386bf Merge remote-tracking branch 'upstream/master' into HEAD 2019-11-29 13:46:48 +01:00
aa4c2898cb Fix identify not compiling for wasm (#1326) 2019-11-29 13:42:46 +01:00
98dac8d509 Merge master into stable-futures (#1325)
* Update parking_lot to v0.9 (#1300)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Publish 0.13.1 (#1304)

* Publish 0.13.1

* Update CHANGELOG.md

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Update some deps of core-derive (#1299)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2019-11-28 18:03:59 +01:00
26f58d20a8 protocols/kad: Fix tests + minor fix in mdns and noise (#1320)
* misc/mdns: Fix missleading error message

* protocols/noise: Remove unneeded tokio-io import

* protocols/kad: Update tests to use stable futures
2019-11-28 16:12:02 +01:00
8d22e98abc Add support for PINGs and PONGs to websockets. (#1319)
* Add support for PINGs and PONGs to websockets.

`Connection` (formerly `BytesConnection`) now supports more structured
`IncomingData` and `OutgoingData` which mirror the data types in
soketto (which are not exposed). This allows adding `Connection::ping`
and `Connection::pong` methods.

The non-framed websocket transport defines `BytesConnection` as a
wrapper around `Connection` and handles only binary data.
2019-11-26 17:37:45 +01:00
8be45f5318 Fix the identify tests (#1324)
* Fix identify tests

* Some clean-up
2019-11-26 14:47:49 +01:00
e5b087d01f Fix the WASM build with stable futures (#1322)
* Fix the WASM build with stable futures

* Fix duplicate dependencies error
2019-11-26 11:48:47 +01:00
e083e82212 Fix tests of libp2p-ping (#1321) 2019-11-25 17:33:59 +01:00
b7644722ee Fix examples and update core-derive. (#1317) 2019-11-25 10:45:04 +01:00
df71d4a861 Update root crate to use futures-0.3. (#1315)
Mostly mechanical. Creating a `CommonTransport` yields an
`io::Result<_>` now since creating the `DnsConfig` may fail with an
`io::Error` when creating the `ThreadPool`.

The `DnsConfig` `Transport` impl had to be changed slightly:

(a) PR [[1311]] requires some `Send` bounds.
(b) The async block had to be changed to work around lifetime inference
issues which resulted in an "one type is more general than the other"
error.

[1311]: https://github.com/libp2p/rust-libp2p/pull/1311
2019-11-22 14:30:21 +01:00
1597b026cb Use soketto's reader-writer-split branch. (#1311) 2019-11-22 14:29:52 +01:00
7cd44ae3de Fix mplex tests (#1314) 2019-11-21 16:14:27 +01:00
812889102c Update mdns dependencies to use futures-0.3 (#1313) 2019-11-20 18:26:21 +01:00
a26620bf39 misc/mdns: Update to futures-preview (#1247)
* misc/mdns/service: Use async std with stack pinned futures

* misc/mdns: Define mdns broadcast address as lazy static

* misc/mdns: Drop future before borrowing their arguments again

* misc/mdns: Send queries on query socket, not socket

* misc/mdns: Use poll_next_unpin on query interval stream

* misc/mdns: Ensure underlying task is woken up on next interval tick

* misc/mdns: Wrap match expression in scope to drop future early

* misc/mdns: Adjust 'discovery_ourselves' test

* misc/mdns: Make query interval fire instantly on first tick

This is an optimization only important for short lived use cases, e.g.
unit tests. Instead of waiting for 20 seconds at first, the query
interval fires right away and thereby the service makes progress
instantly.

* misc/mdns: Adjust MdnsService documentation tests

* misc/mdns: Do not drop UDP socket send and reicv futures

Libp2p-mdns uses the async-std crate for network io. This crate only
offers async send and receive functions. In order to use this in non
async/await functions one needs to keep the future returned by the crate
functions around across `poll` invocations.

The future returned by the crate functions references the io resource.
Thus one has to keep both the io resource as well as the future
referencing it. This results in a self-referencing struct which is not
possible to create with safe Rust.

Instead, by having `MdnsService::next` (former `MdnsService::poll`) take
ownership of `self`, the Rust async magic takes care of the above (See
code comments for more details).

As a (negative) side effect, given that `MdnsService::next` takes
ownership of `self`, there is nothing to bind the lifetime of the
returned `MdnsPacket` to. With no better solution in mind, this patch
makes `MdnsPacket` static, not referencing the `MdnsService` receive
buffer.

* misc/mdns: Fix code comments and remove *if Free* TODO

* misc/mdns: Minor refactorings

* misc/mdns: Build responses in behaviour.rs directly

* misc/mdns: Move response ttl duration to constant

* misc/mdns: Remove optimization todo comment

* misc/mdns: Add query interval test

* misc/mdns: Move packet parsing into MdnPacket impl

* misc/mdns: Don't have receiving packets starve the query interval

When we 'await' on receiving a packet on the udp socket without
receiving a single packet we starve the remaining logic of the mdns
service, in this case the logic triggered on the receive interval.

* misc/mdns: Add debug_assert to MaybeBusyMdnsService check

* misc/mdns: Implement Debug for MaybeBusyMdnsService

* misc/mdns: Make ownership note a normal comment, not a doc comment

* misc/mdns: Have discovered_peers return an iterator
2019-11-20 13:25:12 +01:00
88c2287e44 Update some deps of core-derive (#1299)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2019-11-19 17:25:58 +01:00
02c5f34fc0 Update more crates to futures-0.3 (#1312) 2019-11-19 11:18:16 +01:00
be73b90345 protocols/plaintext: Move to stable futures and use unsigned varints (#1306)
* protocols/plaintext: Move to stable futures and use unsigned varints

The plaintext 2.0 specification requires to use unsigned varints for
frame length delimiting instead of fixed 4 byte integer frame length
delimiting. This commit aligns the implementation with the
specification.

* protocols/secio: Fix doc comment BytesMut -> Vec<u8>

* protocols/plaintext: Add quick check smoke test

* protocols/plaintext: Rework imports and log levels

* protocols/plaintext: Use BytesMut instead of Vec<u8>

* protocols/plaintext: Use BoxFuture
2019-11-19 11:15:35 +01:00
3dd07fcc3a Update libp2p-uds to futures 0.3 (#1308)
* Update libp2p-uds to futures 0.3

* Some clean-up
2019-11-18 12:06:26 +01:00
3e89c36d16 yamux: Use futures-0.3. (#1307) 2019-11-15 16:58:45 +01:00
2015053756 Update yamux to development version. (#1297)
Update yamux to development version.

For the boxed `futures::stream::Stream` we have to decide if we require
a `Send` bound or not. Since some upgrades may produce outputs which are
`!Send` we offer both upgrade versions.
2019-11-15 12:49:52 +01:00
f85241dd36 Update core, tcp, secio and mplex to futures-0.3. (#1302)
* Update `rw-stream-sink` to futures-0.3.

* Update core, tcp, secio and mplex to futures-0.3.

On top of https://github.com/libp2p/rust-libp2p/pull/1301
2019-11-14 13:42:14 +01:00
9e36ef41ac Publish 0.13.1 (#1304)
* Publish 0.13.1

* Update CHANGELOG.md

Co-Authored-By: Toralf Wittner <tw@dtex.org>
v0.13.1
2019-11-13 14:48:15 +01:00
fa7c5c4d47 Update parking_lot to v0.9 (#1300)
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
2019-11-12 13:28:44 +01:00
cb74580e35 websocket: Replace futures-rustls with async-tls. (#1298) 2019-11-08 10:46:34 +01:00
c1226b203a Cherry-pick commits from master to stable-futures (#1296)
* Implement Debug for (ed25519|secp256k1)::(Keypair|SecretKey) (#1285)

* Fix possible arithmetic overflow in libp2p-kad. (#1291)

When the number of active queries exceeds the (internal)
JOBS_MAX_QUERIES limit, which is only supposed to bound
the number of concurrent queries relating to background
jobs, an arithmetic overflow occurs. This is fixed by
using saturating subtraction.

* protocols/plaintext: Add example on how to upgrade with PlainTextConfig1 (#1286)

* [mdns] - Support for long mDNS names (Bug #1232) (#1287)

* Dead code -- commenting out with a note referencing future implementation

* Adding "std" feature so that cargo can build in other directories (notably `misc/mdns`, so that I could run these tests)

* Permitting `PeerID` to be built from an `Identity` multihash

* The length limit for DNS labels is 63 characters, as per RFC1035

* Allocates the vector with capacity for the service name plus additional QNAME encoding bytes

* Added support for encoding/decoding peer IDs with an encoded length greater than 63 characters

* Removing "std" from ring features

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

* Retaining MAX_INLINE_KEY_LENGTH with comment about future usage

* `segment_peer_id` consumes `peer_id` ... plus an early return for IDs that don't need to be segmented

* Fixing logic

* Bump most dependencies (#1268)

* Bump most dependencies

This actually builds 😊.

* Bump all dependencies

Includes the excellent work of @rschulman in #1265.

* Remove use of ed25519-dalek fork

* Monomorphize more dependencies

* Add compatibility hack for rand

Cargo allows a crate to depend on multiple versions of another, but
`cargo-web` panics in that situation.  Use a wrapper crate to work
around the panic.

* Use @tomaka’s idea for using a newer `rand`

instead of my own ugly hack.

* Switch to Parity master

as its dependency-bumping PR has been merged.

* Update some depenendencies again

* Remove unwraps and `#[allow(deprecated)]`.

* Remove spurious changes to dependencies

Bumping minor or patch versions is not needed, and increases likelyhood
of merge conflicts.

* Remove some redundant Cargo.toml changes

* Replace a retry loop with an expect

`ed25519::SecretKey::from_bytes` will never fail for 32-byte inputs.

* Revert changes that don’t belong in this PR

* Remove using void to bypass ICE (#1295)

* Publish 0.13.0 (#1294)
2019-11-06 16:09:15 +01:00
b3b9081f85 Publish 0.13.0 (#1294) v0.13.0 2019-11-06 09:37:22 +01:00
96699a472a Remove using void to bypass ICE (#1295) 2019-11-06 09:19:49 +01:00