Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 5 additions & 6 deletions src/transport/webrtc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,19 +416,18 @@ impl WebRtcTransport {
);

// create new `Rtc` object for the peer and give it the received STUN message
let (mut rtc, noise_channel_id) =
self.make_rtc_client(ufrag, pass, source, self.socket.local_addr().unwrap());
let local_addr = self.socket.local_addr()?;
let (mut rtc, noise_channel_id) = self.make_rtc_client(ufrag, pass, source, local_addr);

rtc.handle_input(Input::Receive(
Instant::now(),
Receive {
source,
proto: Str0mProtocol::Udp,
destination: self.socket.local_addr().unwrap(),
destination: local_addr,
contents,
},
))
.expect("client to handle input successfully");
))?;

let connection_id = self.context.next_connection_id();
let connection = OpeningWebRtcConnection::new(
Expand Down Expand Up @@ -498,7 +497,7 @@ impl TransportBuilder for WebRtcTransport {

const MULTIHASH_SHA256_CODE: u64 = 0x12;
let certificate = Multihash::wrap(MULTIHASH_SHA256_CODE, &fingerprint)
.expect("fingerprint's len to be 32 bytes");
.map_err(|_| Error::InvalidData)?;

vec![Multiaddr::empty()
.with(Protocol::from(listen_address.ip()))
Expand Down
4 changes: 2 additions & 2 deletions src/transport/webrtc/opening.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ impl OpeningWebRtcConnection {
.rtc
.direct_api()
.remote_dtls_fingerprint()
.expect("fingerprint to exist")
.ok_or(Error::InvalidState)?
.clone()
.bytes;

let certificate =
multihash::Multihash::<64>::wrap(Code::Sha2_256.into(), &remote_fingerprint)
.expect("fingerprint's len to be 32 bytes");
.map_err(|_| Error::InvalidData)?;

let address = Multiaddr::empty()
.with(Protocol::from(self.peer_address.ip()))
Expand Down