Rewild Your Web
18
fork

Configure Feed

Select the types of activity you want to include in your feed.

p2p: get rid of useless PeerStatus

webbeef 8bd4fb36 f1a250dc

+34 -26
+6 -2
crates/beaver_p2p/src/state.rs
··· 14 14 15 15 pub(crate) type SharedState = Arc<Mutex<State>>; 16 16 17 - #[derive(Clone, Debug, PartialEq)] 17 + /// The status of a remote peer. 18 + #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] 18 19 pub enum EndpointStatus { 20 + /// Discovered but not paired. 21 + Discovered, 22 + /// Paired and currently connected. 19 23 PairedConnected, 24 + /// Paired but currently disconnected. 20 25 PairedDisconnected, 21 - Discovered, 22 26 } 23 27 24 28 #[derive(Debug)]
+5 -5
patches/components/constellation/pairing.rs.patch
··· 13 13 +use std::path::PathBuf; 14 14 +use std::sync::Arc; 15 15 + 16 - +use beaver_p2p::{EndpointStatus, PairingManager, PeerEvent}; 16 + +use beaver_p2p::{PairingManager, PeerEvent}; 17 17 +use iroh::EndpointId; 18 18 +use iroh::address_lookup::DiscoveryEvent; 19 19 +use log::{debug, error, info, warn}; 20 20 +use serde::{Deserialize, Serialize}; 21 21 +use servo_base::generic_channel::GenericCallback; 22 - +use servo_constellation_traits::{LocalPeerInfo, PairingEvent, PeerInfo, PeerStatus}; 22 + +use servo_constellation_traits::{EndpointStatus, LocalPeerInfo, PairingEvent, PeerInfo}; 23 23 +use tokio::sync::Mutex; 24 24 + 25 25 +/// Typed messages exchanged between paired P2P endpoints. ··· 220 220 + id: ep.id.to_string(), 221 221 + name: ep.name, 222 222 + status: match ep.status { 223 - + EndpointStatus::Discovered => PeerStatus::Discovered, 224 - + EndpointStatus::PairedConnected => PeerStatus::PairedConnected, 223 + + EndpointStatus::Discovered => EndpointStatus::Discovered, 224 + + EndpointStatus::PairedConnected => EndpointStatus::PairedConnected, 225 225 + EndpointStatus::PairedDisconnected => { 226 - + PeerStatus::PairedDisconnected 226 + + EndpointStatus::PairedDisconnected 227 227 + }, 228 228 + }, 229 229 + })
+4 -4
patches/components/script/dom/pairing.rs.patch
··· 8 8 +use dom_struct::dom_struct; 9 9 +use script_bindings::error::Error; 10 10 +use servo_constellation_traits::{ 11 - + LocalPeerInfo, PairingEvent, PeerInfo, PeerStatus, ScriptToConstellationMessage, 11 + + EndpointStatus, LocalPeerInfo, PairingEvent, PeerInfo, ScriptToConstellationMessage, 12 12 +}; 13 13 +use stylo_atoms::Atom; 14 14 + ··· 283 283 + .into_iter() 284 284 + .map(|info| { 285 285 + let status = match info.status { 286 - + PeerStatus::Discovered => "discovered", 287 - + PeerStatus::PairedConnected => "paired-connected", 288 - + PeerStatus::PairedDisconnected => "paired-disconnected", 286 + + EndpointStatus::Discovered => "discovered", 287 + + EndpointStatus::PairedConnected => "paired-connected", 288 + + EndpointStatus::PairedDisconnected => "paired-disconnected", 289 289 + }; 290 290 + Peer::new_with_status( 291 291 + &global,
+10
patches/components/shared/constellation/Cargo.toml.patch
··· 1 + --- original 2 + +++ modified 3 + @@ -18,6 +18,7 @@ 4 + webgpu = ["wgpu-core"] 5 + 6 + [dependencies] 7 + +beaver-p2p = { path = "../../../../crates/beaver_p2p" } 8 + content-security-policy = { workspace = true } 9 + devtools_traits = { workspace = true } 10 + embedder_traits = { workspace = true }
+9 -15
patches/components/shared/constellation/lib.rs.patch
··· 1 1 --- original 2 2 +++ modified 3 - @@ -19,9 +19,10 @@ 3 + @@ -15,13 +15,15 @@ 4 + use std::fmt; 5 + use std::time::Duration; 6 + 7 + +pub use beaver_p2p::EndpointStatus; 8 + use embedder_traits::user_contents::{ 4 9 UserContentManagerId, UserScript, UserScriptId, UserStyleSheet, UserStyleSheetId, 5 10 }; 6 11 use embedder_traits::{ ··· 14 19 }; 15 20 pub use from_script_message::*; 16 21 use malloc_size_of_derive::MallocSizeOf; 17 - @@ -30,15 +31,155 @@ 22 + @@ -30,15 +32,144 @@ 18 23 use rustc_hash::FxHashMap; 19 24 use serde::{Deserialize, Serialize}; 20 25 use servo_base::cross_process_instant::CrossProcessInstant; ··· 98 103 + /// The display name. 99 104 + pub name: String, 100 105 + /// The peer's connection/pairing status. 101 - + pub status: PeerStatus, 102 - +} 103 - + 104 - +/// The status of a remote peer. 105 - +#[derive(Clone, Debug, Deserialize, Serialize)] 106 - +pub enum PeerStatus { 107 - + /// Discovered but not paired. 108 - + Discovered, 109 - + /// Paired and currently connected. 110 - + PairedConnected, 111 - + /// Paired but currently disconnected. 112 - + PairedDisconnected, 106 + + pub status: EndpointStatus, 113 107 +} 114 108 + 115 109 +/// Events from the P2P pairing service, using simple serializable types. ··· 172 166 /// Messages to the Constellation from the embedding layer, whether from `ServoRenderer` or 173 167 /// from `libservo` itself. 174 168 #[derive(IntoStaticStr)] 175 - @@ -118,6 +259,9 @@ 169 + @@ -118,6 +249,9 @@ 176 170 UpdatePinchZoomInfos(PipelineId, PinchZoomInfos), 177 171 /// Activate or deactivate accessibility features for the given `WebView`. 178 172 SetAccessibilityActive(WebViewId, bool),