Skip to content

Commit

Permalink
make pion be the default
Browse files Browse the repository at this point in the history
  • Loading branch information
neonphog committed Oct 28, 2024
1 parent b8eee0a commit 158b98d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ test: static unit
unit:
cargo build --all-targets
RUST_BACKTRACE=1 RUST_LOG=info cargo test -- --nocapture
RUST_BACKTRACE=1 RUST_LOG=info cargo test --no-default-features --features backend-go-pion --manifest-path crates/tx5-connection/Cargo.toml -- --nocapture
RUST_BACKTRACE=1 RUST_LOG=info cargo test --no-default-features --features backend-go-pion --manifest-path crates/tx5/Cargo.toml -- --nocapture
#--TODO--Once libdatachannel is the default, we'll want to keep
# go-pion tested for a while until we're ready to deprecate it
#RUST_BACKTRACE=1 RUST_LOG=info cargo test --no-default-features --features backend-go-pion --manifest-path crates/tx5-connection/Cargo.toml -- --nocapture
#RUST_BACKTRACE=1 RUST_LOG=info cargo test --no-default-features --features backend-go-pion --manifest-path crates/tx5/Cargo.toml -- --nocapture

static: dep fmt lint docs
@if [ "${CI}x" != "x" ]; then git diff --exit-code; fi
Expand Down
2 changes: 1 addition & 1 deletion crates/tx5-connection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ categories = ["network-programming"]
edition = "2021"

[features]
default = [ "backend-libdatachannel" ]
default = [ "backend-go-pion" ]

# use the libdatachannel crate as the webrtc backend
backend-libdatachannel = [ "dep:datachannel" ]
Expand Down
40 changes: 19 additions & 21 deletions crates/tx5-connection/src/webrtc/libdatachannel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,29 +347,27 @@ async fn task_err(
Cmd::RecvMessage(msg) => {
evt_send.send(WebrtcEvt::Message(msg)).await?;
}
Cmd::RecvDescription(desc) => {
match desc.sdp_type {
datachannel::SdpType::Offer => {
evt_send
.send(WebrtcEvt::GeneratedOffer(
serde_json::to_string(&desc)?.into_bytes(),
))
.await?;
}
datachannel::SdpType::Answer => {
evt_send
.send(WebrtcEvt::GeneratedAnswer(
serde_json::to_string(&desc)?.into_bytes(),
))
.await?;
}
_ => {
return Err(std::io::Error::other(
"unhandled sdp desc type",
Cmd::RecvDescription(desc) => match desc.sdp_type {
datachannel::SdpType::Offer => {
evt_send
.send(WebrtcEvt::GeneratedOffer(
serde_json::to_string(&desc)?.into_bytes(),
))
}
.await?;
}
}
datachannel::SdpType::Answer => {
evt_send
.send(WebrtcEvt::GeneratedAnswer(
serde_json::to_string(&desc)?.into_bytes(),
))
.await?;
}
_ => {
return Err(std::io::Error::other(
"unhandled sdp desc type",
))
}
},
Cmd::DataChanOpen => {
evt_send.send(WebrtcEvt::Ready).await?;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tx5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["holochain", "holo", "p2p", "webrtc", "networking"]
categories = ["network-programming"]

[features]
default = [ "backend-libdatachannel" ]
default = [ "backend-go-pion" ]

# use the libdatachannel crate as the webrtc backend
backend-libdatachannel = [ "tx5-connection/backend-libdatachannel" ]
Expand Down
8 changes: 3 additions & 5 deletions crates/tx5/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ impl TestEp {
}
}
EndpointEvent::Disconnected { peer_url } => {
if send
.send((peer_url, DISCON.to_vec()))
.is_err()
{
if send.send((peer_url, DISCON.to_vec())).is_err() {
break;
}
}
Expand Down Expand Up @@ -115,7 +112,8 @@ impl Test {
let _ = tx5_core::Tx5InitConfig {
tracing_enabled: true,
..Default::default()
}.set_as_global_default();
}
.set_as_global_default();

let mut this = Test {
sig_srv_hnd: None,
Expand Down

0 comments on commit 158b98d

Please sign in to comment.