Merge pull request #2103 from zed-industries/connection-staleness

Fix connection staleness issues
This commit is contained in:
Antonio Scandurra 2023-01-27 11:01:24 +01:00 committed by GitHub
commit ac7618da17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 19 deletions

View file

@ -1593,12 +1593,8 @@ impl Database {
.filter(
Condition::all()
.add(
room_participant::Column::CallingConnectionId
.eq(connection.id as i32),
)
.add(
room_participant::Column::CallingConnectionServerId
.eq(connection.owner_id as i32),
room_participant::Column::CallingUserId
.eq(leaving_participant.user_id),
)
.add(room_participant::Column::AnsweringConnectionId.is_null()),
)

View file

@ -166,12 +166,10 @@ async fn test_random_collaboration(
let contacts = server.app_state.db.get_contacts(*user_id).await.unwrap();
let pool = server.connection_pool.lock();
for contact in contacts {
if let db::Contact::Accepted { user_id, .. } = contact {
if pool.is_user_online(user_id) {
assert_ne!(
user_id, removed_user_id,
"removed client is still a contact of another peer"
);
if let db::Contact::Accepted { user_id, busy, .. } = contact {
if user_id == removed_user_id {
assert!(!pool.is_user_online(user_id));
assert!(!busy);
}
}
}