Net: fold websocket and http tokio runtime into one (#31771)

* net: use the same tokio runtime in websocket loader

#31648

* readability

* license
This commit is contained in:
tannal 2024-03-21 14:13:03 +08:00 committed by GitHub
parent 2789e98876
commit 5c0199b568
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 19 additions and 19 deletions

View file

@ -31,7 +31,6 @@ use hyper::{Body, Client, Response as HyperResponse};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
use ipc_channel::router::ROUTER;
use lazy_static::lazy_static;
use log::{debug, error, info, log_enabled, warn};
use msg::constellation_msg::{HistoryStateId, PipelineId};
use net_traits::pub_domains::reg_suffix;
@ -50,13 +49,13 @@ use net_traits::{
};
use servo_arc::Arc;
use servo_url::{ImmutableOrigin, ServoUrl};
use tokio::runtime::Runtime;
use tokio::sync::mpsc::{
channel, unbounded_channel, Receiver as TokioReceiver, Sender as TokioSender,
UnboundedReceiver, UnboundedSender,
};
use tokio_stream::wrappers::ReceiverStream;
use crate::async_runtime::HANDLE;
use crate::connector::{
create_http_client, create_tls_config, CACertificates, CertificateErrorOverrideManager,
Connector,
@ -70,10 +69,6 @@ use crate::hsts::HstsList;
use crate::http_cache::{CacheKey, HttpCache};
use crate::resource_thread::AuthCache;
lazy_static! {
pub static ref HANDLE: Mutex<Option<Runtime>> = Mutex::new(Some(Runtime::new().unwrap()));
}
/// The various states an entry of the HttpCache can be in.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum HttpCacheEntryState {