From fd023cf7937e67dfde5482d34ebc60839eb7397c Mon Sep 17 00:00:00 2001 From: Yusuke Tanaka Date: Fri, 25 Nov 2022 02:38:09 +0900 Subject: fix(ext/flash): graceful server startup/shutdown with unsettled promises in mind (#16616) This PR resets the revert commit made by #16610, bringing back #16383 which attempts to fix the issue happening when we use the flash server with `--watch` option enabled. Also, some code changes are made to pass the regression test added in #16610. --- ext/flash/socket.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ext/flash/socket.rs') diff --git a/ext/flash/socket.rs b/ext/flash/socket.rs index 8256be8a0..7c75b230a 100644 --- a/ext/flash/socket.rs +++ b/ext/flash/socket.rs @@ -1,23 +1,26 @@ use deno_core::error::AnyError; use mio::net::TcpStream; -use std::{ - cell::UnsafeCell, - future::Future, - io::{Read, Write}, - pin::Pin, - sync::{Arc, Mutex}, -}; +use std::cell::UnsafeCell; +use std::future::Future; +use std::io::Read; +use std::io::Write; +use std::marker::PhantomPinned; +use std::pin::Pin; +use std::sync::Arc; +use std::sync::Mutex; use tokio::sync::mpsc; use crate::ParseStatus; type TlsTcpStream = rustls::StreamOwned; +#[derive(Debug)] pub enum InnerStream { Tcp(TcpStream), Tls(Box), } +#[derive(Debug)] pub struct Stream { pub inner: InnerStream, pub detached: bool, @@ -26,6 +29,7 @@ pub struct Stream { pub parse_done: ParseStatus, pub buffer: UnsafeCell>, pub read_lock: Arc>, + pub _pinned: PhantomPinned, } impl Stream { -- cgit v1.2.3