This commit is contained in:
parent
54a3ef4f11
commit
bed73a82f1
1 changed files with 59 additions and 55 deletions
|
|
@ -3,7 +3,7 @@ use mtp_codec::{
|
|||
registry::{Registry, VersionedCodec},
|
||||
};
|
||||
use mtp_common::CommunicationError;
|
||||
use mtp_transport::{Policy, Receiver, Sender};
|
||||
use mtp_transport::Policy;
|
||||
use std::net::IpAddr;
|
||||
#[cfg(feature = "crypto")]
|
||||
use std::pin::Pin;
|
||||
|
|
@ -13,6 +13,8 @@ use tokio::time::Duration;
|
|||
|
||||
pub use MTPConnection as Connection;
|
||||
pub use MTPHost as Host;
|
||||
pub use mtp_transport::Receiver;
|
||||
pub use mtp_transport::Sender;
|
||||
|
||||
/* ---- async callback type aliases ---- */
|
||||
#[cfg(feature = "crypto")]
|
||||
|
|
@ -382,8 +384,9 @@ impl MTPHost {
|
|||
_ => None,
|
||||
};
|
||||
|
||||
let (flow, response_type) =
|
||||
if hello.get_type() == mtp_codec::CommunicationType::Identification.to_id(&tm) {
|
||||
let (flow, response_type) = if hello.get_type()
|
||||
== mtp_codec::CommunicationType::Identification.to_id(&tm)
|
||||
{
|
||||
let cid = match hello.get_data(DataType::Id) {
|
||||
DataValue::UnsignedNumber(n) => *n as u64,
|
||||
_ => {
|
||||
|
|
@ -393,8 +396,7 @@ impl MTPHost {
|
|||
));
|
||||
}
|
||||
};
|
||||
let bundle = match (self.config.get_existing_client)(cid, description.clone()).await
|
||||
{
|
||||
let bundle = match (self.config.get_existing_client)(cid, description.clone()).await {
|
||||
Some(b) => b,
|
||||
None => {
|
||||
let rejection = CommunicationValue::new(
|
||||
|
|
@ -590,7 +592,8 @@ impl MTPHost {
|
|||
let (assigned_id, client_bundle) = match flow {
|
||||
Flow::Login { id, bundle } => (id, bundle),
|
||||
Flow::Register { bundle, .. } => {
|
||||
let new_id = (self.config.complete_register)(bundle.clone(), description.clone()).await;
|
||||
let new_id =
|
||||
(self.config.complete_register)(bundle.clone(), description.clone()).await;
|
||||
(new_id, bundle)
|
||||
}
|
||||
};
|
||||
|
|
@ -725,7 +728,8 @@ impl MTPHost {
|
|||
};
|
||||
|
||||
if cid > 0
|
||||
&& let Some(bundle) = (self.config.get_existing_client)(cid, description.clone()).await
|
||||
&& let Some(bundle) =
|
||||
(self.config.get_existing_client)(cid, description.clone()).await
|
||||
{
|
||||
return self
|
||||
.complete_auth_handshake(
|
||||
|
|
|
|||
Loading…
Reference in a new issue