mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 19:47:17 +00:00
enc punch
This commit is contained in:
@@ -18,9 +18,8 @@ use hbb_common::{
|
||||
};
|
||||
|
||||
use hbb_common::{
|
||||
config::{RENDEZVOUS_PORT, RENDEZVOUS_TIMEOUT},
|
||||
config::{CONNECT_TIMEOUT, RENDEZVOUS_PORT},
|
||||
futures::future::join_all,
|
||||
protobuf::Message as _,
|
||||
rendezvous_proto::*,
|
||||
};
|
||||
|
||||
@@ -1003,7 +1002,7 @@ async fn check_id(
|
||||
) -> &'static str {
|
||||
if let Ok(mut socket) = hbb_common::socket_client::connect_tcp(
|
||||
crate::check_port(rendezvous_server, RENDEZVOUS_PORT),
|
||||
RENDEZVOUS_TIMEOUT,
|
||||
CONNECT_TIMEOUT,
|
||||
)
|
||||
.await
|
||||
{
|
||||
@@ -1016,34 +1015,34 @@ async fn check_id(
|
||||
});
|
||||
let mut ok = false;
|
||||
if socket.send(&msg_out).await.is_ok() {
|
||||
if let Some(Ok(bytes)) = socket.next_timeout(3_000).await {
|
||||
if let Ok(msg_in) = RendezvousMessage::parse_from_bytes(&bytes) {
|
||||
match msg_in.union {
|
||||
Some(rendezvous_message::Union::RegisterPkResponse(rpr)) => {
|
||||
match rpr.result.enum_value_or_default() {
|
||||
register_pk_response::Result::OK => {
|
||||
ok = true;
|
||||
}
|
||||
register_pk_response::Result::ID_EXISTS => {
|
||||
return "Not available";
|
||||
}
|
||||
register_pk_response::Result::TOO_FREQUENT => {
|
||||
return "Too frequent";
|
||||
}
|
||||
register_pk_response::Result::NOT_SUPPORT => {
|
||||
return "server_not_support";
|
||||
}
|
||||
register_pk_response::Result::SERVER_ERROR => {
|
||||
return "Server error";
|
||||
}
|
||||
register_pk_response::Result::INVALID_ID_FORMAT => {
|
||||
return INVALID_FORMAT;
|
||||
}
|
||||
_ => {}
|
||||
if let Some(msg_in) =
|
||||
crate::common::get_next_nonkeyexchange_msg(&mut socket, None).await
|
||||
{
|
||||
match msg_in.union {
|
||||
Some(rendezvous_message::Union::RegisterPkResponse(rpr)) => {
|
||||
match rpr.result.enum_value_or_default() {
|
||||
register_pk_response::Result::OK => {
|
||||
ok = true;
|
||||
}
|
||||
register_pk_response::Result::ID_EXISTS => {
|
||||
return "Not available";
|
||||
}
|
||||
register_pk_response::Result::TOO_FREQUENT => {
|
||||
return "Too frequent";
|
||||
}
|
||||
register_pk_response::Result::NOT_SUPPORT => {
|
||||
return "server_not_support";
|
||||
}
|
||||
register_pk_response::Result::SERVER_ERROR => {
|
||||
return "Server error";
|
||||
}
|
||||
register_pk_response::Result::INVALID_ID_FORMAT => {
|
||||
return INVALID_FORMAT;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user