mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Fix data channels borrowing errors
This commit is contained in:
parent
b968852456
commit
7eb44f81f2
2 changed files with 18 additions and 14 deletions
|
@ -311,17 +311,20 @@ impl RTCPeerConnection {
|
|||
event.upcast::<Event>().fire(self.upcast());
|
||||
},
|
||||
_ => {
|
||||
if let Some(ref channel) = self.data_channels.borrow().get(&channel_id) {
|
||||
match event {
|
||||
DataChannelEvent::Open => channel.on_open(),
|
||||
DataChannelEvent::Close => channel.on_close(),
|
||||
DataChannelEvent::Error(error) => channel.on_error(error),
|
||||
DataChannelEvent::OnMessage(message) => channel.on_message(message),
|
||||
DataChannelEvent::StateChange(state) => channel.on_state_change(state),
|
||||
DataChannelEvent::NewChannel => unreachable!(),
|
||||
}
|
||||
let channel = if let Some(channel) = self.data_channels.borrow().get(&channel_id) {
|
||||
DomRoot::from_ref(&**channel)
|
||||
} else {
|
||||
debug_assert!(false, "Got an event for an unregistered data channel");
|
||||
return;
|
||||
};
|
||||
|
||||
match event {
|
||||
DataChannelEvent::Open => channel.on_open(),
|
||||
DataChannelEvent::Close => channel.on_close(),
|
||||
DataChannelEvent::Error(error) => channel.on_error(error),
|
||||
DataChannelEvent::OnMessage(message) => channel.on_message(message),
|
||||
DataChannelEvent::StateChange(state) => channel.on_state_change(state),
|
||||
DataChannelEvent::NewChannel => unreachable!(),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue