Skip to main content

tuwunel_admin/query/sync/
show_connection.rs

1use ruma::{OwnedDeviceId, OwnedUserId};
2use tuwunel_core::Result;
3use tuwunel_service::sync::into_connection_key;
4
5use crate::admin_command;
6
7#[admin_command]
8pub(super) async fn show_connection(
9	&self,
10	user_id: OwnedUserId,
11	device_id: Option<OwnedDeviceId>,
12	conn_id: Option<String>,
13) -> Result {
14	let key = into_connection_key(user_id, device_id, conn_id);
15	let cache = self
16		.services
17		.sync
18		.get_loaded_connection(&key)
19		.await?;
20
21	let out;
22	{
23		let cached = cache.lock().await;
24		out = format!("{cached:#?}");
25	};
26
27	self.write_str(out.as_str()).await
28}