mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-23 16:59:54 +00:00
check authexception and channel
Signed-off-by: 高兴烨 <gaoxingye@huawei.com>
This commit is contained in:
parent
590fa715e3
commit
a4c464858d
@ -58,6 +58,11 @@ bool AuthNegotiateChannel::operator==(const AuthNegotiateChannel &other) const
|
||||
return handle_.authId == other.handle_.authId && handle_.type == other.handle_.type;
|
||||
}
|
||||
|
||||
bool AuthNegotiateChannel::operator==(const AuthHandle &otherHandle) const
|
||||
{
|
||||
return handle_.authId == otherHandle.authId && handle_.type == otherHandle.type;
|
||||
}
|
||||
|
||||
bool AuthNegotiateChannel::IsMeta() const
|
||||
{
|
||||
bool isMeta = false;
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
~AuthNegotiateChannel() override;
|
||||
|
||||
bool operator==(const AuthNegotiateChannel &other) const;
|
||||
bool operator==(const AuthHandle &otherHandle) const;
|
||||
bool IsMeta() const;
|
||||
void SetClose();
|
||||
|
||||
|
@ -603,12 +603,16 @@ void P2pV1Processor::ProcessAuthConnEvent(std::shared_ptr<AuthOpenEvent> &event)
|
||||
|
||||
void P2pV1Processor::ProcessAuthExceptionEvent(const std::shared_ptr<AuthExceptionEvent> &event)
|
||||
{
|
||||
CONN_CHECK_AND_RETURN_LOGE(connectCommand_ != nullptr, CONN_WIFI_DIRECT, "connect command is nullptr");
|
||||
CONN_LOGE(CONN_WIFI_DIRECT, "AuthExceptionEvent error=%{public}d", event->error_);
|
||||
if (connectCommand_ != nullptr) {
|
||||
CleanupIfNeed(event->error_, connectCommand_->GetRemoteDeviceId());
|
||||
connectCommand_->OnFailure(static_cast<WifiDirectErrorCode>(event->error_));
|
||||
connectCommand_ = nullptr;
|
||||
}
|
||||
auto negotiateChannel = connectCommand_->GetConnectInfo().channel_;
|
||||
CONN_CHECK_AND_RETURN_LOGE(negotiateChannel != nullptr, CONN_WIFI_DIRECT, "auth negotiate channel is nullptr");
|
||||
auto authChannel = std::dynamic_pointer_cast<AuthNegotiateChannel>(negotiateChannel);
|
||||
CONN_CHECK_AND_RETURN_LOGE(authChannel != nullptr && *authChannel == event->handle_,
|
||||
CONN_WIFI_DIRECT, "other auth exception ignore");
|
||||
CleanupIfNeed(event->error_, connectCommand_->GetRemoteDeviceId());
|
||||
connectCommand_->OnFailure(static_cast<WifiDirectErrorCode>(event->error_));
|
||||
connectCommand_ = nullptr;
|
||||
Terminate();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user