MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / new_remote_inspector_id

Function new_remote_inspector_id

packages/server/src/webkit.rs:1198–1218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1196}
1197
1198fn new_remote_inspector_id() -> String {
1199 let counter = WEBKIT_ID_COUNTER.fetch_add(1, Ordering::Relaxed);
1200 let now = SystemTime::now()
1201 .duration_since(UNIX_EPOCH)
1202 .unwrap_or(Duration::ZERO)
1203 .as_nanos();
1204 let pid = std::process::id() as u128;
1205 let value = now ^ (pid << 48) ^ counter as u128;
1206 let mut bytes = value.to_be_bytes();
1207 bytes[6] = (bytes[6] & 0x0f) | 0x40;
1208 bytes[8] = (bytes[8] & 0x3f) | 0x80;
1209 let hex = hex::encode(bytes);
1210 format!(
1211 "{}-{}-{}-{}-{}",
1212 &hex[0..8],
1213 &hex[8..12],
1214 &hex[12..16],
1215 &hex[16..20],
1216 &hex[20..32]
1217 )
1218}
1219
1220fn string_value(args: &Dictionary, key: &str) -> Option<String> {
1221 args.get(key)

Callers 2

run_connectionMethod · 0.85
attach_websocket_innerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected