1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Revert "fix(runtime): send ws ping frames from inspector server (#263… (#26513)

This commit is contained in:
Bartek Iwańczuk 2024-10-24 18:43:24 +01:00 committed by GitHub
parent 9c80ddaf93
commit b063cfecfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,6 @@ use deno_core::InspectorSessionProxy;
use deno_core::JsRuntime; use deno_core::JsRuntime;
use fastwebsockets::Frame; use fastwebsockets::Frame;
use fastwebsockets::OpCode; use fastwebsockets::OpCode;
use fastwebsockets::Payload;
use fastwebsockets::WebSocket; use fastwebsockets::WebSocket;
use hyper::body::Bytes; use hyper::body::Bytes;
use hyper_util::rt::TokioIo; use hyper_util::rt::TokioIo;
@ -34,7 +33,6 @@ use std::pin::pin;
use std::process; use std::process;
use std::rc::Rc; use std::rc::Rc;
use std::thread; use std::thread;
use std::time::Duration;
use tokio::net::TcpListener; use tokio::net::TcpListener;
use tokio::sync::broadcast; use tokio::sync::broadcast;
use uuid::Uuid; use uuid::Uuid;
@ -395,13 +393,8 @@ async fn pump_websocket_messages(
inbound_tx: UnboundedSender<String>, inbound_tx: UnboundedSender<String>,
mut outbound_rx: UnboundedReceiver<InspectorMsg>, mut outbound_rx: UnboundedReceiver<InspectorMsg>,
) { ) {
let mut ticker = tokio::time::interval(Duration::from_secs(30));
'pump: loop { 'pump: loop {
tokio::select! { tokio::select! {
_ = ticker.tick() => {
let _ = websocket.write_frame(Frame::new(true, OpCode::Ping, None, Payload::Borrowed(&[]))).await;
}
Some(msg) = outbound_rx.next() => { Some(msg) = outbound_rx.next() => {
let msg = Frame::text(msg.content.into_bytes().into()); let msg = Frame::text(msg.content.into_bytes().into());
let _ = websocket.write_frame(msg).await; let _ = websocket.write_frame(msg).await;