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,
|
addr: String,
|
||||||
mux_options: MuxOptions,
|
mux_options: MuxOptions,
|
||||||
) -> Result<(), Box<dyn std::error::Error + Sync + Send>> {
|
) -> 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);
|
let rx = FragmentCollectorRead::new(rx);
|
||||||
|
|
||||||
println!("{:?}: connected", addr);
|
println!("{:?}: connected", addr);
|
||||||
// to prevent memory ""leaks"" because users are sending in packets way too fast the buffer
|
// 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 {
|
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?
|
.await?
|
||||||
.with_required_extensions(&[PasswordProtocolExtension::ID]).await?
|
|
||||||
} else {
|
} else {
|
||||||
ServerMux::create(
|
ServerMux::create(
|
||||||
rx,
|
rx,
|
||||||
tx,
|
tx,
|
||||||
128,
|
512,
|
||||||
Some(&[Box::new(UdpProtocolExtensionBuilder())]),
|
Some(&[Box::new(UdpProtocolExtensionBuilder())]),
|
||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.with_no_required_extensions()
|
.with_no_required_extensions()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this results in one stream ""leaking"" a maximum of ~512M
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"{:?}: downgraded: {} extensions supported: {:?}",
|
"{:?}: downgraded: {} extensions supported: {:?}",
|
||||||
addr, mux.downgraded, mux.supported_extension_ids
|
addr, mux.downgraded, mux.supported_extension_ids
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue