Fix potential memory leak
This commit is contained in:
parent
75d69de86c
commit
576188da12
@ -97,7 +97,7 @@ async fn index() -> HttpResponse {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SendWrapper(mpsc::Sender<Vec<u8>>);
|
struct SendWrapper(mpsc::SyncSender<Vec<u8>>);
|
||||||
|
|
||||||
impl Write for SendWrapper {
|
impl Write for SendWrapper {
|
||||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||||
@ -122,7 +122,7 @@ struct FileStreamer {
|
|||||||
|
|
||||||
impl FileStreamer {
|
impl FileStreamer {
|
||||||
pub fn start() -> Self {
|
pub fn start() -> Self {
|
||||||
let (send, receive) = mpsc::channel();
|
let (send, receive) = mpsc::sync_channel(1);
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let mut tar = tar::Builder::new(SendWrapper(send));
|
let mut tar = tar::Builder::new(SendWrapper(send));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user