提交 500e6134 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi

Fix plain transport notifications parsing

上级 004823fc
...@@ -206,8 +206,13 @@ struct Handlers { ...@@ -206,8 +206,13 @@ struct Handlers {
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(tag = "event", rename_all = "lowercase", content = "data")] #[serde(tag = "event", rename_all = "lowercase", content = "data")]
enum Notification { enum Notification {
Tuple(TransportTuple), Tuple {
RtcpTuple(TransportTuple), tuple: TransportTuple,
},
#[serde(rename_all = "camelCase")]
RtcpTuple {
rtcp_tuple: TransportTuple,
},
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
SctpStateChange { SctpStateChange {
sctp_state: SctpState, sctp_state: SctpState,
...@@ -517,14 +522,14 @@ impl PlainTransport { ...@@ -517,14 +522,14 @@ impl PlainTransport {
channel.subscribe_to_notifications(id.into(), move |notification| { channel.subscribe_to_notifications(id.into(), move |notification| {
match serde_json::from_value::<Notification>(notification) { match serde_json::from_value::<Notification>(notification) {
Ok(notification) => match notification { Ok(notification) => match notification {
Notification::Tuple(tuple) => { Notification::Tuple { tuple } => {
*data.tuple.lock() = tuple; *data.tuple.lock() = tuple;
handlers.tuple.call(|callback| { handlers.tuple.call(|callback| {
callback(&tuple); callback(&tuple);
}); });
} }
Notification::RtcpTuple(rtcp_tuple) => { Notification::RtcpTuple { rtcp_tuple } => {
data.rtcp_tuple.lock().replace(rtcp_tuple); data.rtcp_tuple.lock().replace(rtcp_tuple);
handlers.rtcp_tuple.call(|callback| { handlers.rtcp_tuple.call(|callback| {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论