huskies: merge 742_refactor_read_rpc_frame_multiplexer_on_crdt_sync_websocket

This commit is contained in:
dave
2026-04-27 21:22:55 +00:00
parent c1bb5888a8
commit be7b7025d5
5 changed files with 394 additions and 0 deletions
+9
View File
@@ -11,6 +11,7 @@ use crate::slog_warn;
use super::auth;
use super::dispatch::{handle_incoming_binary, handle_incoming_text};
use super::rpc::try_handle_rpc_text;
use super::wire::{AuthMessage, ChallengeMessage, HelloMessage, ServerAuthMessage, SyncMessage};
use super::{AUTH_TIMEOUT_SECS, PING_INTERVAL_SECS, PONG_TIMEOUT_SECS};
@@ -363,6 +364,14 @@ pub(crate) async fn connect_and_sync(url: &str, token: Option<&str>) -> Result<(
if !flush_ok {
break;
}
} else if let Some(rpc_resp) = try_handle_rpc_text(text.as_ref()) {
// RPC request from the peer — dispatch and reply.
use tokio_tungstenite::tungstenite::Message as TungsteniteMsg;
if let Ok(json) = serde_json::to_string(&rpc_resp)
&& sink.send(TungsteniteMsg::Text(json.into())).await.is_err()
{
break;
}
} else {
handle_incoming_text(text.as_ref());
}