Skip to content

Commit

Permalink
fix deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Prabhat1308 committed Aug 23, 2024
1 parent 81cfb6a commit 0a13b59
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions transports/webrtc-websys/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ impl RtcPeerConnection {

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

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

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

Expand All @@ -214,8 +214,9 @@ impl RtcPeerConnection {

let dc = match negotiated {
true => {
let mut options = RtcDataChannelInit::new();
options.negotiated(true).id(0); // id is only ever set to zero when negotiated is true
let options = RtcDataChannelInit::new();
options.set_negotiated(true);
options.set_id(0); // id is only ever set to zero when negotiated is true

self.inner
.create_data_channel_with_data_channel_dict(LABEL, &options)
Expand Down
8 changes: 4 additions & 4 deletions transports/webrtc-websys/src/sdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pub(crate) fn answer(
server_fingerprint: Fingerprint,
client_ufrag: &str,
) -> RtcSessionDescriptionInit {
let mut answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer);
answer_obj.sdp(&libp2p_webrtc_utils::sdp::answer(
let answer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Answer);
answer_obj.set_sdp(&libp2p_webrtc_utils::sdp::answer(
addr,
server_fingerprint,
client_ufrag,
Expand Down Expand Up @@ -48,8 +48,8 @@ pub(crate) fn offer(offer: String, client_ufrag: &str) -> RtcSessionDescriptionI

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

let mut offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer);
offer_obj.sdp(&munged_sdp_offer);
let offer_obj = RtcSessionDescriptionInit::new(RtcSdpType::Offer);
offer_obj.set_sdp(&munged_sdp_offer);

offer_obj
}
1 change: 1 addition & 0 deletions transports/webrtc-websys/src/stream/poll_data_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ impl PollDataChannel {
return Poll::Ready(Err(io::ErrorKind::BrokenPipe.into()))
}
RtcDataChannelState::Open | RtcDataChannelState::__Invalid => {}
_ => {}
}

if self.overloaded.load(Ordering::SeqCst) {
Expand Down

0 comments on commit 0a13b59

Please sign in to comment.