mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
decrease max ws message size, increase flow control buffer
This commit is contained in:
parent
b3f35b232f
commit
ce2660943a
1 changed files with 12 additions and 5 deletions
|
@ -306,27 +306,34 @@ async fn accept_ws(
|
|||
addr: String,
|
||||
mux_options: MuxOptions,
|
||||
) -> Result<(), Box<dyn std::error::Error + Sync + Send>> {
|
||||
let (rx, tx) = ws.await?.split(tokio::io::split);
|
||||
let mut ws = ws.await?;
|
||||
// to prevent memory ""leaks"" because users are sending in packets way too fast the message
|
||||
// size is set to 1M
|
||||
ws.set_max_message_size(1024 * 1024);
|
||||
let (rx, tx) = ws.split(tokio::io::split);
|
||||
let rx = FragmentCollectorRead::new(rx);
|
||||
|
||||
println!("{:?}: connected", addr);
|
||||
// to prevent memory ""leaks"" because users are sending in packets way too fast the buffer
|
||||
// size is set to 128
|
||||
// size is set to 512
|
||||
let (mux, fut) = if mux_options.enforce_auth {
|
||||
ServerMux::create(rx, tx, 128, Some(mux_options.auth.as_slice()))
|
||||
ServerMux::create(rx, tx, 512, Some(mux_options.auth.as_slice()))
|
||||
.await?
|
||||
.with_required_extensions(&[PasswordProtocolExtension::ID])
|
||||
.await?
|
||||
.with_required_extensions(&[PasswordProtocolExtension::ID]).await?
|
||||
} else {
|
||||
ServerMux::create(
|
||||
rx,
|
||||
tx,
|
||||
128,
|
||||
512,
|
||||
Some(&[Box::new(UdpProtocolExtensionBuilder())]),
|
||||
)
|
||||
.await?
|
||||
.with_no_required_extensions()
|
||||
};
|
||||
|
||||
// this results in one stream ""leaking"" a maximum of ~512M
|
||||
|
||||
println!(
|
||||
"{:?}: downgraded: {} extensions supported: {:?}",
|
||||
addr, mux.downgraded, mux.supported_extension_ids
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue