1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

egui_inspection: add transport connect/Listener helpers

Add transport::connect (dial + split) and a sync transport::Listener
(bind + accept) so both ends of the inspection connection build streams
identically without depending on interprocess directly. Plugin now dials
via transport::connect. These back the kittest harness moving onto the
same local socket as the live plugin.
This commit is contained in:
lucasmerlin
2026-05-26 16:25:55 +02:00
parent 72389ed5a8
commit b27bc2b9ea
2 changed files with 49 additions and 8 deletions

View File

@@ -30,10 +30,9 @@ use std::sync::{Arc, Mutex, OnceLock};
use std::thread;
use egui::{Context, FullOutput, RawInput};
use interprocess::local_socket::{RecvHalf, SendHalf, Stream, prelude::*};
use crate::INSPECTION_SOCKET_ENV_VAR;
use crate::transport::socket_name;
use crate::transport::{self, RecvHalf, SendHalf};
use crate::protocol::{
Capabilities, Frame, FrameScreenshot, HarnessMessage, InspectorCommand, PROTOCOL_VERSION,
PeerHello, PeerKind, read_message, write_message,
@@ -122,9 +121,8 @@ impl InspectionPlugin {
/// # Errors
/// When the socket can't be dialed or a thread can't be spawned.
pub fn attach(socket: &str, label: Option<String>) -> Result<Self, InspectionError> {
let name = socket_name(socket).map_err(InspectionError::Connect)?;
let stream = Stream::connect(name).map_err(InspectionError::Connect)?;
let (reader_stream, writer_stream) = stream.split();
let (reader_stream, writer_stream) =
transport::connect(socket).map_err(InspectionError::Connect)?;
let shared_ctx: SharedCtx = Arc::new(OnceLock::new());