Skip to content

Commit

Permalink
Add RTCPeerConnection::Close
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Mar 25, 2019
1 parent 5cb5503 commit 7343241
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions components/script/dom/rtcpeerconnection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,31 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
fn SignalingState(&self) -> RTCSignalingState {
self.signaling_state.get()
}

/// https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close
fn Close(&self) {
// Step 1
if self.closed.get() {
return;
}
// Step 2
self.closed.set(true);

// Step 4
self.signaling_state.set(RTCSignalingState::Closed);

// Step 5 handled by backend
self.controller.borrow_mut().as_ref().unwrap().quit();

// Step 6-10
// (no current support for data channels, transports, etc)

// Step 11
self.ice_connection_state.set(RTCIceConnectionState::Closed);

// Step 11
// (no current support for connection state)
}
}

impl From<SessionDescription> for RTCSessionDescriptionInit {
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/RTCPeerConnection.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface RTCPeerConnection : EventTarget {
// static sequence<RTCIceServer> getDefaultIceServers();
// RTCConfiguration getConfiguration();
// void setConfiguration(RTCConfiguration configuration);
// void close();
void close();
attribute EventHandler onnegotiationneeded;
attribute EventHandler onicecandidate;
// attribute EventHandler onicecandidateerror;
Expand Down

0 comments on commit 7343241

Please sign in to comment.