Compare commits

...
3 Commits
Author SHA1 Message Date
Riz Ashraf 8c6bf05269 feat: implement native UDP ping/pong health check pattern 2026-10-08 12:46:55 +01:00
Riz Ashraf 0da84c804c chore: test UDP rendezvous 2026-10-08 11:36:42 +01:00
Riz Ashraf 8e3d356167 chore: test UDP rendezvous 2026-10-08 11:35:13 +01:00
3 changed files with 8 additions and 4 deletions

No files matched your search

+6 -4
View File
@@ -368,11 +368,13 @@ pub async fn run_server(state: Arc<MemoryState>) -> Result<(), Box<dyn std::erro
for tx in senders { for tx in senders {
let _ = tx.try_send(msg_str.clone()); let _ = tx.try_send(msg_str.clone());
} }
} else if let Ok(gate_wait) = serde_json::from_slice::<serde_json::Value>(&buf[..len]) { } else if let Ok(json_payload) = serde_json::from_slice::<serde_json::Value>(&buf[..len]) {
if gate_wait.get("type").and_then(|t| t.as_str()) == Some("gate_wait") { if json_payload.get("type").and_then(|t| t.as_str()) == Some("ping") {
let _ = socket.send_to(b"pong", addr).await;
} else if json_payload.get("type").and_then(|t| t.as_str()) == Some("gate_wait") {
if let (Some(action), Some(target)) = ( if let (Some(action), Some(target)) = (
gate_wait.get("action").and_then(|a| a.as_str()), json_payload.get("action").and_then(|a| a.as_str()),
gate_wait.get("target").and_then(|t| t.as_str()) json_payload.get("target").and_then(|t| t.as_str())
) { ) {
subscribers.insert((action.to_string(), target.to_string()), addr); subscribers.insert((action.to_string(), target.to_string()), addr);
} }
+1
View File
@@ -0,0 +1 @@
test
+1
View File
@@ -0,0 +1 @@
test