Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c6bf05269 | ||
|
|
0da84c804c | ||
|
|
8e3d356167 |
No files matched your search
+6
-4
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
test
|
||||||
Reference in new issue
Block a user