Skip to content

Commit

Permalink
Added basic yamux connection upgrade
Browse files Browse the repository at this point in the history
Yamux provides multiplexing over a ordered reliable connection (e.g. TCP).
More info: https://github.com/hashicorp/yamux/blob/master/spec.md

- This is working from a fork of yamux (develop branch), where the
  upgrade to futures 0.3.x is close to complete
- Made a TcpStream wrapper struct which implements futures `AsyncWrite` and `AsyncRead` to reduce the tie in to tokio
- _Side note:_ investigated upgrading to futures 0.3.x however there ended up being a few external libraries which are locked to alpha futures. This is WIP for tonic (hyperium/tonic#163) and tower (no PR - we may be able to pretty easily remove this dependency)
  • Loading branch information
sdbondi committed Dec 10, 2019
1 parent 677e66a commit 8717ba4
Show file tree
Hide file tree
Showing 16 changed files with 386 additions and 179 deletions.
14 changes: 13 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1

defaults:
rust_image: &rust_image quay.io/tarilabs/rust_tari-build-with-deps:nightly-2019-10-04
Expand All @@ -9,6 +9,10 @@ jobs:
- image: *rust_image
steps:
- checkout
- run:
command: |
git submodule update --init --recursive
name: Init git submodule
- run:
name: RFC documentation
command: |
Expand All @@ -25,6 +29,10 @@ jobs:
- image: quay.io/tarilabs/git-ssh-client:0.2-alpine
steps:
- checkout
- run:
command: |
git submodule update --init --recursive
name: Init git submodule
- attach_workspace:
at: .
- add_ssh_keys:
Expand Down Expand Up @@ -68,6 +76,10 @@ jobs:
resource_class: medium
steps:
- checkout
- run:
command: |
git submodule update --init --recursive
name: Init git submodule
- run:
name: Tari source code
command: |
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "comms/yamux"]
path = comms/yamux
url = https://github.com/tari-project/yamux.git
branch = futures-alpha
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* [RFC documents](https://rfc.tari.com) are hosted on Github Pages. The source markdown is in the `RFC` directory.
* Source code documentation is hosted on [docs.rs](https://docs.rs)
* Build instructions are found [here](./BUILDING.md)

### Serving the documentation locally

Expand Down Expand Up @@ -35,6 +36,18 @@ to generate the documentation. The generated html sits in `target/doc/`. Alterna

See [RFC-0110/CodeStructure](./RFC/src/RFC-0010_CodeStructure.md) for details on the code structure and layout.

## Git submodules

Git submodules are use temporarily until some dependent libraries are stabilized and released as crates.
When checking out code take the following steps to ensure submodules are up to date.

```shell script
# Sets `git pull` to automatically pull submodules
git config submodule.recurse true
# Checkout/update all submodules
git submodule update --recursive --remote
```

## Conversation channels

[<img src="https://ionicons.com/ionicons/svg/md-paper-plane.svg" width="32">](https://t.me/tarilab) Non-technical discussions and gentle sparring.
Expand Down
140 changes: 0 additions & 140 deletions base_layer/p2p/tests/ping_pong/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion base_layer/p2p/tests/services/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fn end_to_end() {
runtime,
liveness1.get_event_stream_fused(),
take = 18,
timeout = Duration::from_secs(10),
timeout = Duration::from_secs(20),
);

let ping_count = events
Expand Down
1 change: 1 addition & 0 deletions comms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ time = "0.1.42"
tokio = "0.2.0-alpha.6"
tokio-executor = { version ="^0.2.0-alpha.6", features = ["threadpool"] }
ttl_cache = "0.5.1"
yamux = {path="./yamux"}
zmq = "0.9.2"

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions comms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod connection_manager;
mod consts;
pub mod control_service;
pub mod inbound_message_service;
mod multiplexing;
mod noise;
pub mod outbound_message_service;
pub mod peer_manager;
Expand Down
23 changes: 23 additions & 0 deletions comms/src/multiplexing/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2019, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pub mod yamux;
Loading

0 comments on commit 8717ba4

Please sign in to comment.