Initialize stream buffer
This commit is contained in:
parent
9d0acfe615
commit
a80a77bbb8
|
|
@ -5,6 +5,7 @@ use std::ffi::{CStr, CString};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
use std::iter;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::net;
|
use std::net;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
@ -770,14 +771,7 @@ impl<S: Read+Write> SslStream<S> {
|
||||||
stream: stream,
|
stream: stream,
|
||||||
ssl: Arc::new(ssl),
|
ssl: Arc::new(ssl),
|
||||||
// Maximum TLS record size is 16k
|
// Maximum TLS record size is 16k
|
||||||
// We're just using this as a buffer, so there's no reason to pay
|
buf: iter::repeat(0).take(16 * 1024).collect(),
|
||||||
// to memset it
|
|
||||||
buf: {
|
|
||||||
const CAP: usize = 16 * 1024;
|
|
||||||
let mut v = Vec::with_capacity(CAP);
|
|
||||||
unsafe { v.set_len(CAP); }
|
|
||||||
v
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue