Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jt/82 webrtcinrustping #84

Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
766c909
starting
John-LittleBearLabs Nov 28, 2022
ad93609
Merge remote-tracking branch 'up/master' into jt/82_webrtcinrustping
John-LittleBearLabs Nov 28, 2022
65117e1
squash! Merge remote-tracking branch 'up/master' into jt/82_webrtcinr…
John-LittleBearLabs Nov 28, 2022
54466dd
compiles...
John-LittleBearLabs Nov 29, 2022
2653436
unknown protocol string: webrtc
John-LittleBearLabs Nov 29, 2022
a9a4f18
Update Cargo.toml to pull in new release
John-LittleBearLabs Nov 30, 2022
79b4441
hold
John-LittleBearLabs Nov 30, 2022
b114212
Restricting to webrtc-enabled versions to verify that.
John-LittleBearLabs Dec 2, 2022
2cc28e0
switch to test_param. Currently taking its value only from default, a…
John-LittleBearLabs Dec 2, 2022
2d0bc4a
removing some temporary stuff
John-LittleBearLabs Dec 2, 2022
31666f5
oops
John-LittleBearLabs Dec 2, 2022
31e8197
Change to optional return value
John-LittleBearLabs Dec 2, 2022
76b9283
Merge remote-tracking branch 'up/master' into jt/82_webrtcinrustping
John-LittleBearLabs Dec 2, 2022
8991625
Post-merge duplicate group IDs, also reverting inappropriate type cha…
John-LittleBearLabs Dec 2, 2022
89ce9f1
express it in code
John-LittleBearLabs Dec 2, 2022
35869fe
Porting updates to testplan_0510
John-LittleBearLabs Dec 2, 2022
e9c0ba4
Some PR comments
John-LittleBearLabs Dec 5, 2022
5cae933
expect
John-LittleBearLabs Dec 6, 2022
afe3a77
logging verbosity
John-LittleBearLabs Dec 9, 2022
24c1f23
listen_on now returns an address across all versions.
John-LittleBearLabs Dec 9, 2022
a8fefc2
updates
John-LittleBearLabs Dec 12, 2022
c3207d2
Positive consequences of previous shifts.
John-LittleBearLabs Dec 13, 2022
8696244
cargo fmt
ddimaria Dec 14, 2022
c916d4b
fix clippy lints
ddimaria Dec 14, 2022
3dab17b
prefer Anyhow's context
ddimaria Dec 14, 2022
26f311a
Improve logging, fix typo
ddimaria Dec 15, 2022
753cd1b
Merge branch 'libp2p:master' into jt/82_webrtcinrustping
ddimaria Dec 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,116 changes: 1,012 additions & 104 deletions ping/rust/Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions ping/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ libp2pv0461 = { package = "libp2p", version = "0.46.1", default_features = false
libp2pv0470 = { package = "libp2p", version = "0.47.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std"] }
libp2pv0480 = { package = "libp2p", version = "0.48.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa"] }
libp2pv0490 = { package = "libp2p", version = "0.49.0", features = ["websocket", "mplex", "yamux", "tcp", "async-std", "ping", "noise", "dns", "rsa"] }
libp2pv0500 = { package = "libp2p", version = "0.50.0", features = ["websocket", "mplex", "yamux", "tcp", "async-std", "ping", "noise", "dns", "rsa", "macros"] }
libp2pv0500 = { package = "libp2p", version = "0.50.0", features = ["websocket", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "dns", "rsa", "macros", "webrtc"] }

# Next release
[dependencies."libp2pv0510"]
package = "libp2p"
git = "https://github.com/libp2p/rust-libp2p"
rev = "be0b62a78fe9d72811b9eda742137cc8ddc4da35" # This should usually point to a commit on master.
features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa", "macros"]
features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"]
3 changes: 2 additions & 1 deletion ping/rust/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ instances = { min = 2, max = 10000, default = 5 }

[testcases.params]
max_latency_ms = { type = "int", desc = "maximum value for random local link latency", unit = "ms", default = 1000 }
iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 }
iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 }
transport = { type = "enum", desc = "transport used", values = ["tcp", "webrtc"], default = "tcp" }
18 changes: 9 additions & 9 deletions ping/rust/src/bin/testplan_0440.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async fn main() -> Result<()> {
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we undo these formatting changes please?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was resolved with a whole pass of cargo fmt

{
received_pings.insert(peer);
}
Expand Down
18 changes: 9 additions & 9 deletions ping/rust/src/bin/testplan_0451.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async fn main() -> Result<()> {
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
{
received_pings.insert(peer);
}
Expand Down
18 changes: 9 additions & 9 deletions ping/rust/src/bin/testplan_0461.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async fn main() -> Result<()> {
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
{
received_pings.insert(peer);
}
Expand Down
18 changes: 9 additions & 9 deletions ping/rust/src/bin/testplan_0470.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async fn main() -> Result<()> {
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
{
received_pings.insert(peer);
}
Expand Down
18 changes: 9 additions & 9 deletions ping/rust/src/bin/testplan_0480.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ async fn main() -> Result<()> {
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
{
received_pings.insert(peer);
}
Expand Down
22 changes: 11 additions & 11 deletions ping/rust/src/bin/testplan_0490.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ async fn main() -> Result<()> {
development_transport(local_key).await?,
ping::Behaviour::new(
#[allow(deprecated)]
// TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055.
ping::Config::new()
// TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055.
ping::Config::new()
.with_interval(Duration::from_secs(1))
.with_keep_alive(true),
),
local_peer_id,
));

run_ping(swarm).await?;
let client = testground::client::Client::new_and_init()
.await
.expect("Unable to init testground cient.");
run_ping(swarm, client).await?;

Ok(())
}
Expand All @@ -33,18 +35,16 @@ struct OrphanRuleWorkaround(Swarm<ping::Behaviour>);

#[async_trait]
impl PingSwarm for OrphanRuleWorkaround {
async fn listen_on(&mut self, address: &str) -> Result<()> {
async fn listen_on(&mut self, address: &str) -> Result<String> {
let id = self.0.listen_on(address.parse()?)?;

loop {
if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await {
if listener_id == id {
break;
return Ok(address.to_string());
}
}
}

Ok(())
}

fn dial(&mut self, address: &str) -> Result<()> {
Expand All @@ -68,9 +68,9 @@ impl PingSwarm for OrphanRuleWorkaround {

while received_pings.len() < number {
if let Some(SwarmEvent::Behaviour(ping::Event {
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
peer,
result: Ok(ping::Success::Ping { .. }),
})) = self.0.next().await
{
received_pings.insert(peer);
}
Expand Down
Loading