mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
net: clean shutdown of the async runtime (#38425)
The previous use of a static variable for the runtime prevented it from shutting down cleanly, because shutdown requires dropping or taking ownership of it. This PR switches the static variable to a handle only, and introduces a new trait to pass a handle to the async runtime to the constellation, where it can be shut-down along with other components and help reduce our count of still running threads after shutdown. Testing: manual testing, and covered by unit-test in net, and wpt tests. Fixes: part of - https://github.com/servo/servo/issues/30849 --------- Signed-off-by: gterzian <2792687+gterzian@users.noreply.github.com>
This commit is contained in:
parent
7ad32f944f
commit
77ff351cde
11 changed files with 132 additions and 49 deletions
|
@ -39,7 +39,7 @@ use tungstenite::handshake::client::{Request, Response};
|
|||
use tungstenite::protocol::CloseFrame;
|
||||
use url::Url;
|
||||
|
||||
use crate::async_runtime::HANDLE;
|
||||
use crate::async_runtime::spawn_task;
|
||||
use crate::connector::{CACertificates, TlsConfig, create_tls_config};
|
||||
use crate::cookie::ServoCookie;
|
||||
use crate::fetch::methods::{
|
||||
|
@ -423,7 +423,7 @@ fn connect(
|
|||
tls_config.alpn_protocols = vec!["http/1.1".to_string().into()];
|
||||
|
||||
let resource_event_sender2 = resource_event_sender.clone();
|
||||
HANDLE.spawn(
|
||||
spawn_task(
|
||||
start_websocket(
|
||||
http_state,
|
||||
req_url.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue