Skip to content

Commit

Permalink
Merge AsyncUserSocks into AsyncUsers, make sockid AtomicUsize
Browse files Browse the repository at this point in the history
Revise authentication logic to use constant time string comparison

Greatly reduce write locks on users hashmap,
particularly when authenticating messages attempt to optimistically load with a read lock
  • Loading branch information
serprex committed Jan 10, 2024
1 parent e0f06f0 commit 69e703e
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 111 deletions.
2 changes: 1 addition & 1 deletion src/rs/server/src/handleget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ async fn handle_get_core(
} else if path.starts_with("/collection/") {
let name = &path["/collection/".len()..];
if let Ok(client) = pgpool.get().await {
if let Some(user) = users.write().await.load(&*client, name).await {
if let Some(user) = users.write().await.load(&*client, name, None).await {
let user = user.lock().await;
let pool = &user.data.pool;
let bound = &user.data.accountbound;
Expand Down
Loading

0 comments on commit 69e703e

Please sign in to comment.