This commit is contained in:
parent
3d757e00f2
commit
6a65e43ca9
10 changed files with 353 additions and 104 deletions
|
|
@ -797,7 +797,18 @@ impl WasmClient {
|
|||
let request_bytes = request
|
||||
.to_bytes()
|
||||
.map_err(|e| js_error(&format!("encode failed: {}", e)))?;
|
||||
web_sys::console::log_1(
|
||||
&format!(
|
||||
"[mtp wasm] create_pipe sending PipeRequest id={} description={description} bytes={}",
|
||||
pipe_id,
|
||||
request_bytes.len()
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
transport.send_frame(&request_bytes).await?;
|
||||
web_sys::console::log_1(
|
||||
&format!("[mtp wasm] create_pipe sent PipeRequest id={pipe_id}").into(),
|
||||
);
|
||||
|
||||
Ok(WasmPipeHandle {
|
||||
pipe_id,
|
||||
|
|
@ -824,7 +835,13 @@ impl WasmClient {
|
|||
let resp_bytes = resp
|
||||
.to_bytes()
|
||||
.map_err(|e| js_error(&format!("encode failed: {}", e)))?;
|
||||
web_sys::console::log_1(
|
||||
&format!("[mtp wasm] accept_pipe sending PipeResponse id={pipe_id} accepted=true bytes={}", resp_bytes.len()).into(),
|
||||
);
|
||||
transport.send_frame(&resp_bytes).await?;
|
||||
web_sys::console::log_1(
|
||||
&format!("[mtp wasm] accept_pipe sent PipeResponse id={pipe_id}").into(),
|
||||
);
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
self.pending_pipes.borrow_mut().insert(pipe_id, tx);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@ pub(crate) fn log_stream_error_code(error: &JsValue, context: &str) {
|
|||
let stream_error_code = js_sys::Reflect::get(error, &JsValue::from_str("streamErrorCode"))
|
||||
.ok()
|
||||
.and_then(|v| v.as_f64());
|
||||
if matches!(stream_error_code, Some(0.0)) {
|
||||
// WebTransport reports peer-driven stream shutdown as code 0 in this
|
||||
// environment. For one-frame handshake streams, that is expected and
|
||||
// should not be surfaced as a warning.
|
||||
return;
|
||||
}
|
||||
let message = error
|
||||
.as_string()
|
||||
.or_else(|| {
|
||||
|
|
@ -138,21 +144,24 @@ impl WasmTransport {
|
|||
if let Some(hashes) = cert_hashes {
|
||||
let wt_hashes = js_sys::Array::new();
|
||||
for h in hashes {
|
||||
if let Some((algo, hex_val)) = h.split_once(':') {
|
||||
if let Ok(bytes) = hex::decode(hex_val) {
|
||||
let hash = js_sys::Object::new();
|
||||
js_sys::Reflect::set(
|
||||
&hash,
|
||||
&JsValue::from_str("algorithm"),
|
||||
&JsValue::from_str(algo),
|
||||
)?;
|
||||
js_sys::Reflect::set(
|
||||
&hash,
|
||||
&JsValue::from_str("value"),
|
||||
&js_sys::Uint8Array::from(&bytes[..]),
|
||||
)?;
|
||||
wt_hashes.push(&hash);
|
||||
}
|
||||
let (algo, hex_val) = match h.split_once(':') {
|
||||
Some((algo, hex_val)) => (algo, hex_val),
|
||||
None => ("sha-256", h.as_str()),
|
||||
};
|
||||
|
||||
if let Ok(bytes) = hex::decode(hex_val) {
|
||||
let hash = js_sys::Object::new();
|
||||
js_sys::Reflect::set(
|
||||
&hash,
|
||||
&JsValue::from_str("algorithm"),
|
||||
&JsValue::from_str(algo),
|
||||
)?;
|
||||
js_sys::Reflect::set(
|
||||
&hash,
|
||||
&JsValue::from_str("value"),
|
||||
&js_sys::Uint8Array::from(&bytes[..]),
|
||||
)?;
|
||||
wt_hashes.push(&hash);
|
||||
}
|
||||
}
|
||||
if wt_hashes.length() > 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue