MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / register

Method register

nodedb/src/control/security/session_registry.rs:51–69  ·  view source on GitHub ↗

Register a new session. Returns a kill signal receiver.

(&self, session_id: &str, params: &SessionParams)

Source from the content-addressed store, hash-verified

49
50 /// Register a new session. Returns a kill signal receiver.
51 pub fn register(&self, session_id: &str, params: &SessionParams) -> watch::Receiver<bool> {
52 let now = crate::control::security::time::now_secs();
53 let (kill_tx, kill_rx) = watch::channel(false);
54 let entry = RegisteredSession {
55 user_id: params.user_id.clone(),
56 db_user: params.db_user.clone(),
57 peer_addr: params.peer_addr.clone(),
58 protocol: params.protocol.clone(),
59 auth_method: params.auth_method.clone(),
60 tenant_id: params.tenant_id,
61 connected_at: now,
62 last_active: std::sync::atomic::AtomicU64::new(now),
63 kill_tx,
64 };
65
66 let mut sessions = self.sessions.write().unwrap_or_else(|p| p.into_inner());
67 sessions.insert(session_id.into(), entry);
68 kill_rx
69 }
70
71 /// Unregister a session (on disconnect).
72 pub fn unregister(&self, session_id: &str) {

Callers 4

register_and_killFunction · 0.45
unregister_removesFunction · 0.45
kill_by_ipFunction · 0.45
different_users_isolatedFunction · 0.45

Calls 4

now_secsFunction · 0.70
cloneMethod · 0.45
writeMethod · 0.45
insertMethod · 0.45

Tested by 4

register_and_killFunction · 0.36
unregister_removesFunction · 0.36
kill_by_ipFunction · 0.36
different_users_isolatedFunction · 0.36