Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
ws-rst
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qlintonger xeno
ws-rst
Commits
69abda68
Commit
69abda68
authored
Feb 27, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
再次更新+34
parent
a23b1e0d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
src/events.rs
+1
-0
src/handles/handle_agora_call.rs
+10
-1
No files found.
src/events.rs
View file @
69abda68
...
@@ -49,6 +49,7 @@ pub async fn close_existing_connection(from_id: &(String, u128), close_old: bool
...
@@ -49,6 +49,7 @@ pub async fn close_existing_connection(from_id: &(String, u128), close_old: bool
// 关闭旧连接:找到所有连接时间小于当前时间的连接
// 关闭旧连接:找到所有连接时间小于当前时间的连接
let
mut
keys_to_remove
=
Vec
::
new
();
let
mut
keys_to_remove
=
Vec
::
new
();
for
entry
in
CLIENT_SENDERS
.iter
()
{
for
entry
in
CLIENT_SENDERS
.iter
()
{
println!
(
"当前key {:?}"
,
entry
.key
());
if
entry
.key
()
.
0
==
real_user_id
.to_string
()
&&
entry
.key
()
.
1
<
current_time
{
if
entry
.key
()
.
0
==
real_user_id
.to_string
()
&&
entry
.key
()
.
1
<
current_time
{
keys_to_remove
.push
(
entry
.key
()
.clone
());
keys_to_remove
.push
(
entry
.key
()
.clone
());
}
}
...
...
src/handles/handle_agora_call.rs
View file @
69abda68
...
@@ -435,7 +435,7 @@ pub async fn handle_agora_call(
...
@@ -435,7 +435,7 @@ pub async fn handle_agora_call(
if
let
Some
(
sender
)
=
refuse_procedure_map
.get
(
from_id
)
{
sender
.send
(())
.ok
();
}
if
let
Some
(
sender
)
=
refuse_procedure_map
.get
(
from_id
)
{
sender
.send
(())
.ok
();
}
if
let
Some
(
sender
)
=
channel_hangup_procedure_map
.get
(
&
channel_id
)
{
sender
.send
(())
.ok
();
}
if
let
Some
(
sender
)
=
channel_hangup_procedure_map
.get
(
&
channel_id
)
{
sender
.send
(())
.ok
();
}
let
mut
real_host_id
=
String
::
new
();
if
!
ONLINE_USERS
.iter
()
.any
(|
e
|
e
.value
()
.split
(
','
)
.nth
(
CHANNEL_IDX
)
.unwrap_or
(
""
)
==
channel_id
&&
e
.value
()
.split
(
','
)
.nth
(
HOST_IDX
)
.unwrap_or
(
""
)
==
"1"
)
{
if
!
ONLINE_USERS
.iter
()
.any
(|
e
|
e
.value
()
.split
(
','
)
.nth
(
CHANNEL_IDX
)
.unwrap_or
(
""
)
==
channel_id
&&
e
.value
()
.split
(
','
)
.nth
(
HOST_IDX
)
.unwrap_or
(
""
)
==
"1"
)
{
let
initiator
=
channel_id
.split
(
'_'
)
.next
()
.unwrap_or
(
""
);
let
initiator
=
channel_id
.split
(
'_'
)
.next
()
.unwrap_or
(
""
);
let
host_id
=
if
HOST_ENABLED_ID_SET
.contains
(
initiator
)
{
let
host_id
=
if
HOST_ENABLED_ID_SET
.contains
(
initiator
)
{
...
@@ -447,6 +447,7 @@ pub async fn handle_agora_call(
...
@@ -447,6 +447,7 @@ pub async fn handle_agora_call(
.find
(|
id
|
HOST_ENABLED_ID_SET
.contains
(
id
.as_str
()))
.find
(|
id
|
HOST_ENABLED_ID_SET
.contains
(
id
.as_str
()))
.unwrap_or_else
(||
ONLINE_USERS
.iter
()
.find
(|
e
|
e
.value
()
.split
(
','
)
.nth
(
CHANNEL_IDX
)
.unwrap_or
(
""
)
==
channel_id
)
.map
(|
e
|
e
.key
()
.clone
())
.unwrap_or_default
())
.unwrap_or_else
(||
ONLINE_USERS
.iter
()
.find
(|
e
|
e
.value
()
.split
(
','
)
.nth
(
CHANNEL_IDX
)
.unwrap_or
(
""
)
==
channel_id
)
.map
(|
e
|
e
.key
()
.clone
())
.unwrap_or_default
())
};
};
real_host_id
=
host_id
.to_string
();
let
joined
=
update_user_status
(
&
host_id
,
&
ONLINE_USERS
.get
(
&
host_id
)
.map
(|
v
|
v
.split
(
','
)
.next
()
.unwrap_or
(
"idle"
)
.to_string
())
.unwrap_or
(
"idle"
.into
()),
&
channel_id
,
true
);
let
joined
=
update_user_status
(
&
host_id
,
&
ONLINE_USERS
.get
(
&
host_id
)
.map
(|
v
|
v
.split
(
','
)
.next
()
.unwrap_or
(
"idle"
)
.to_string
())
.unwrap_or
(
"idle"
.into
()),
&
channel_id
,
true
);
update_redis_async
(
host_id
,
joined
);
update_redis_async
(
host_id
,
joined
);
}
}
...
@@ -465,6 +466,14 @@ pub async fn handle_agora_call(
...
@@ -465,6 +466,14 @@ pub async fn handle_agora_call(
"toID"
:
user_id
"toID"
:
user_id
})
.to_string
(),
&
user_id
)
.await
;
})
.to_string
(),
&
user_id
)
.await
;
}
}
// 修改状态数据
let
joined
=
update_user_status
(
&
user_id
,
"calling"
,
&
channel_id
,
real_host_id
==
user_id
);
update_redis_async
(
user_id
,
joined
);
}
}
tokio
::
spawn
(
async
move
{
notify_all_clients_to_update_online_users
()
.await
;
});
tokio
::
spawn
(
async
move
{
notify_all_clients_to_update_online_users
()
.await
;
});
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment