mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
io: increase MAX_BUF
from 16384 to 2MiB (#5397)
This commit is contained in:
parent
c90757f07a
commit
fe2dcb9453
@ -231,12 +231,12 @@ fn flush_while_idle() {
|
||||
#[cfg_attr(miri, ignore)] // takes a really long time with miri
|
||||
fn read_with_buffer_larger_than_max() {
|
||||
// Chunks
|
||||
let chunk_a = 16 * 1024;
|
||||
let chunk_a = crate::io::blocking::MAX_BUF;
|
||||
let chunk_b = chunk_a * 2;
|
||||
let chunk_c = chunk_a * 3;
|
||||
let chunk_d = chunk_a * 4;
|
||||
|
||||
assert_eq!(chunk_d / 1024, 64);
|
||||
assert_eq!(chunk_d / 1024 / 1024, 8);
|
||||
|
||||
let mut data = vec![];
|
||||
for i in 0..(chunk_d - 1) {
|
||||
@ -303,12 +303,12 @@ fn read_with_buffer_larger_than_max() {
|
||||
#[cfg_attr(miri, ignore)] // takes a really long time with miri
|
||||
fn write_with_buffer_larger_than_max() {
|
||||
// Chunks
|
||||
let chunk_a = 16 * 1024;
|
||||
let chunk_a = crate::io::blocking::MAX_BUF;
|
||||
let chunk_b = chunk_a * 2;
|
||||
let chunk_c = chunk_a * 3;
|
||||
let chunk_d = chunk_a * 4;
|
||||
|
||||
assert_eq!(chunk_d / 1024, 64);
|
||||
assert_eq!(chunk_d / 1024 / 1024, 8);
|
||||
|
||||
let mut data = vec![];
|
||||
for i in 0..(chunk_d - 1) {
|
||||
|
@ -26,7 +26,7 @@ pub(crate) struct Buf {
|
||||
pos: usize,
|
||||
}
|
||||
|
||||
pub(crate) const MAX_BUF: usize = 16 * 1024;
|
||||
pub(crate) const MAX_BUF: usize = 2 * 1024 * 1024;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum State<T> {
|
||||
|
@ -108,14 +108,13 @@ where
|
||||
#[cfg(test)]
|
||||
#[cfg(not(loom))]
|
||||
mod tests {
|
||||
use crate::io::blocking::MAX_BUF;
|
||||
use crate::io::AsyncWriteExt;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
|
||||
const MAX_BUF: usize = 16 * 1024;
|
||||
|
||||
struct TextMockWriter;
|
||||
|
||||
impl crate::io::AsyncWrite for TextMockWriter {
|
||||
|
Loading…
x
Reference in New Issue
Block a user