Skip to content

Commit aa9317f

Browse files
Prabhat1308dariusc93jxsmergify[bot]
authored
fix: Change __Nonexhaustive to __Invalid and update web-sys (#5569)
## Description Bumps up web-sys version to `0.3.70` fixes #5557 ## Change checklist - [X] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [ ] I have added tests that prove my fix is effective or that my feature works - [X] A changelog entry has been made in the appropriate crates --------- Co-authored-by: Darius Clark <[email protected]> Co-authored-by: João Oliveira <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent de8cba9 commit aa9317f

File tree

10 files changed

+62
-41
lines changed

10 files changed

+62
-41
lines changed

Cargo.lock

Lines changed: 33 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ libp2p-uds = { version = "0.41.0", path = "transports/uds" }
111111
libp2p-upnp = { version = "0.3.0", path = "protocols/upnp" }
112112
libp2p-webrtc = { version = "0.8.0-alpha", path = "transports/webrtc" }
113113
libp2p-webrtc-utils = { version = "0.3.0", path = "misc/webrtc-utils" }
114-
libp2p-webrtc-websys = { version = "0.4.0-alpha", path = "transports/webrtc-websys" }
114+
libp2p-webrtc-websys = { version = "0.4.0-alpha.2", path = "transports/webrtc-websys" }
115115
libp2p-websocket = { version = "0.44.0", path = "transports/websocket" }
116116
libp2p-websocket-websys = { version = "0.4.0", path = "transports/websocket-websys" }
117117
libp2p-webtransport-websys = { version = "0.4.0", path = "transports/webtransport-websys" }

transports/webrtc-websys/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.4.0-alpha.2
2+
3+
- Bump version of web-sys and update `__Nonexhaustive` to `__Invalid`.
4+
See [PR 5569](https://github.com/libp2p/rust-libp2p/pull/5569)
5+
16
## 0.4.0-alpha
27

38
- Implement refactored `Transport`.

transports/webrtc-websys/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT"
88
name = "libp2p-webrtc-websys"
99
repository = "https://github.com/libp2p/rust-libp2p"
1010
rust-version = { workspace = true }
11-
version = "0.4.0-alpha"
11+
version = "0.4.0-alpha.2"
1212
publish = true
1313

1414
[dependencies]
@@ -25,7 +25,7 @@ thiserror = "1"
2525
tracing = { workspace = true }
2626
wasm-bindgen = { version = "0.2.90" }
2727
wasm-bindgen-futures = { version = "0.4.42" }
28-
web-sys = { version = "0.3.69", features = ["Document", "Location", "MessageEvent", "Navigator", "RtcCertificate", "RtcConfiguration", "RtcDataChannel", "RtcDataChannelEvent", "RtcDataChannelInit", "RtcDataChannelState", "RtcDataChannelType", "RtcPeerConnection", "RtcSdpType", "RtcSessionDescription", "RtcSessionDescriptionInit", "Window"] }
28+
web-sys = { version = "0.3.70", features = ["Document", "Location", "MessageEvent", "Navigator", "RtcCertificate", "RtcConfiguration", "RtcDataChannel", "RtcDataChannelEvent", "RtcDataChannelInit", "RtcDataChannelState", "RtcDataChannelType", "RtcPeerConnection", "RtcSdpType", "RtcSessionDescription", "RtcSessionDescriptionInit", "Window"] }
2929

3030
[lints]
3131
workspace = true

transports/webrtc-websys/src/connection.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ impl RtcPeerConnection {
186186

187187
let certificate = JsFuture::from(certificate_promise).await?;
188188

189-
let mut config = RtcConfiguration::default();
189+
let config = RtcConfiguration::default();
190190
// wrap certificate in a js Array first before adding it to the config object
191191
let certificate_arr = js_sys::Array::new();
192192
certificate_arr.push(&certificate);
193-
config.certificates(&certificate_arr);
193+
config.set_certificates(&certificate_arr);
194194

195195
let inner = web_sys::RtcPeerConnection::new_with_configuration(&config)?;
196196

@@ -214,8 +214,9 @@ impl RtcPeerConnection {
214214

215215
let dc = match negotiated {
216216
true => {
217-
let mut options = RtcDataChannelInit::new();
218-
options.negotiated(true).id(0); // id is only ever set to zero when negotiated is true
217+
let options = RtcDataChannelInit::new();
218+
options.set_negotiated(true);
219+
options.set_id(0); // id is only ever set to zero when negotiated is true
219220

220221
self.inner
221222
.create_data_channel_with_data_channel_dict(LABEL, &options)

transports/webrtc-websys/src/sdp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ pub(crate) fn answer(
88
server_fingerprint: Fingerprint,
99
client_ufrag: &str,
1010
) -> RtcSessionDescriptionInit {
11-
let mut answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer);
12-
answer_obj.sdp(&libp2p_webrtc_utils::sdp::answer(
11+
let answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer);
12+
answer_obj.set_sdp(&libp2p_webrtc_utils::sdp::answer(
1313
addr,
1414
server_fingerprint,
1515
client_ufrag,
@@ -48,8 +48,8 @@ pub(crate) fn offer(offer: String, client_ufrag: &str) -> RtcSessionDescriptionI
4848

4949
tracing::trace!(offer=%munged_sdp_offer, "Created SDP offer");
5050

51-
let mut offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer);
52-
offer_obj.sdp(&munged_sdp_offer);
51+
let offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer);
52+
offer_obj.set_sdp(&munged_sdp_offer);
5353

5454
offer_obj
5555
}

transports/webrtc-websys/src/stream/poll_data_channel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ impl PollDataChannel {
143143
RtcDataChannelState::Closing | RtcDataChannelState::Closed => {
144144
return Poll::Ready(Err(io::ErrorKind::BrokenPipe.into()))
145145
}
146-
RtcDataChannelState::Open | RtcDataChannelState::__Nonexhaustive => {}
146+
RtcDataChannelState::Open | RtcDataChannelState::__Invalid => {}
147+
_ => {}
147148
}
148149

149150
if self.overloaded.load(Ordering::SeqCst) {

transports/webtransport-websys/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- Implement refactored `Transport`.
44
See [PR 4568](https://github.com/libp2p/rust-libp2p/pull/4568)
5+
- Bump version of web-sys and wasm-bindgen.
6+
See [PR 5569](https://github.com/libp2p/rust-libp2p/pull/5569)
57

68
## 0.3.0
79

transports/webtransport-websys/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ categories = ["network-programming", "asynchronous"]
1515

1616
[dependencies]
1717
futures = { workspace = true }
18-
js-sys = "0.3.69"
18+
js-sys = "0.3.70"
1919
libp2p-core = { workspace = true }
2020
libp2p-identity = { workspace = true }
2121
libp2p-noise = { workspace = true }
@@ -24,9 +24,9 @@ multihash = { workspace = true }
2424
send_wrapper = { version = "0.6.0", features = ["futures"] }
2525
thiserror = "1.0.61"
2626
tracing = { workspace = true }
27-
wasm-bindgen = "0.2.90"
28-
wasm-bindgen-futures = "0.4.42"
29-
web-sys = { version = "0.3.69", features = [
27+
wasm-bindgen = "0.2.93"
28+
wasm-bindgen-futures = "0.4.43"
29+
web-sys = { version = "0.3.70", features = [
3030
"ReadableStreamDefaultReader",
3131
"WebTransport",
3232
"WebTransportBidirectionalStream",

wasm-tests/webtransport-tests/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ libp2p-noise = { workspace = true }
1717
libp2p-webtransport-websys = { workspace = true }
1818
multiaddr = { workspace = true }
1919
multihash = { workspace = true }
20-
wasm-bindgen = "0.2.90"
21-
wasm-bindgen-futures = "0.4.42"
22-
wasm-bindgen-test = "0.3.42"
23-
web-sys = { version = "0.3.69", features = ["Response", "Window"] }
20+
wasm-bindgen = "0.2.93"
21+
wasm-bindgen-futures = "0.4.43"
22+
wasm-bindgen-test = "0.3.43"
23+
web-sys = { version = "0.3.70", features = ["Response", "Window"] }
2424

2525
[lints]
2626
workspace = true

0 commit comments

Comments
 (0)