mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-12 14:00:01 -04:00
fix pong read
This commit is contained in:
parent
09b15e3c43
commit
2dfcb0021f
2 changed files with 5 additions and 0 deletions
|
@ -111,6 +111,7 @@ pub async fn route(
|
||||||
ws_upgrade(req, |fut, wsproxy, udp, path| async move {
|
ws_upgrade(req, |fut, wsproxy, udp, path| async move {
|
||||||
let mut ws = fut.await.context("failed to await upgrade future")?;
|
let mut ws = fut.await.context("failed to await upgrade future")?;
|
||||||
ws.set_max_message_size(CONFIG.server.max_message_size);
|
ws.set_max_message_size(CONFIG.server.max_message_size);
|
||||||
|
ws.set_auto_pong(false);
|
||||||
|
|
||||||
if wsproxy {
|
if wsproxy {
|
||||||
let ws = WebSocketStreamWrapper(FragmentCollector::new(ws));
|
let ws = WebSocketStreamWrapper(FragmentCollector::new(ws));
|
||||||
|
|
|
@ -27,6 +27,7 @@ pub(crate) enum WsEvent {
|
||||||
SendPong(Payload<'static>),
|
SendPong(Payload<'static>),
|
||||||
WispMessage(Option<Packet<'static>>, Option<Frame<'static>>),
|
WispMessage(Option<Packet<'static>>, Option<Frame<'static>>),
|
||||||
EndFut(Option<CloseReason>),
|
EndFut(Option<CloseReason>),
|
||||||
|
Noop
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MuxMapValue {
|
struct MuxMapValue {
|
||||||
|
@ -238,6 +239,8 @@ impl<R: WebSocketRead + Send> MuxInner<R> {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else if frame.opcode == OpCode::Ping {
|
} else if frame.opcode == OpCode::Ping {
|
||||||
return Ok(Some(WsEvent::SendPong(frame.payload)));
|
return Ok(Some(WsEvent::SendPong(frame.payload)));
|
||||||
|
} else if frame.opcode == OpCode::Pong {
|
||||||
|
return Ok(Some(WsEvent::Noop));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref extra_frame) = optional_frame {
|
if let Some(ref extra_frame) = optional_frame {
|
||||||
|
@ -342,6 +345,7 @@ impl<R: WebSocketRead + Send> MuxInner<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WsEvent::Noop => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue