update core/connection/wifi_direct_cpp/wifi_direct_scheduler.cpp.

Signed-off-by: shiyifan <shiyifan10@huawei.com>
This commit is contained in:
shiyifan 2024-08-23 08:34:54 +00:00 committed by Gitee
parent d4c40e1306
commit 60c6f7e3bd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -36,11 +36,11 @@ int WifiDirectScheduler::ConnectDevice(const WifiDirectConnectInfo &info, const
auto command = CommandFactory::GetInstance().CreateConnectCommand(info, callback);
command->SetRetried(markRetried);
std::shared_ptr<WifiDirectExecutor> executor;
std::lock_guard executorLock(executorLock_);
auto ret = ScheduleActiveCommand(command, executor);
CONN_CHECK_AND_RETURN_RET_LOGE(ret == SOFTBUS_OK, ret, CONN_WIFI_DIRECT, "schedule active command failed");
if (executor != nullptr) {
CONN_LOGI(CONN_WIFI_DIRECT, "commandId=%{public}u", command->GetId());
std::lock_guard executorLock(executorLock_);
executor->SendEvent(command);
}
return ret;
@ -76,11 +76,11 @@ int WifiDirectScheduler::DisconnectDevice(WifiDirectDisconnectInfo &info, WifiDi
WifiDirectAnonymizeDeviceId(command->GetRemoteDeviceId()).c_str());
std::shared_ptr<WifiDirectExecutor> executor;
std::lock_guard executorLock(executorLock_);
auto ret = ScheduleActiveCommand(command, executor);
CONN_CHECK_AND_RETURN_RET_LOGE(ret == SOFTBUS_OK, ret, CONN_WIFI_DIRECT, "schedule active command failed");
if (executor != nullptr) {
CONN_LOGI(CONN_WIFI_DIRECT, "commandId=%{public}u", command->GetId());
std::lock_guard executorLock(executorLock_);
executor->SendEvent(command);
}
return ret;
@ -96,12 +96,12 @@ int WifiDirectScheduler::ForceDisconnectDevice(
WifiDirectAnonymizeDeviceId(WifiDirectUtils::UuidToNetworkId(command->GetRemoteDeviceId())).c_str(),
WifiDirectAnonymizeDeviceId(command->GetRemoteDeviceId()).c_str(), info.linkType);
std::shared_ptr<WifiDirectExecutor> executor;
std::lock_guard executorLock(executorLock_);
auto ret = ScheduleActiveCommand(command, executor);
CONN_CHECK_AND_RETURN_RET_LOGE(
ret == SOFTBUS_OK, ret, CONN_WIFI_DIRECT, "schedule active command failed, ret=%{public}d", ret);
if (executor != nullptr) {
CONN_LOGI(CONN_WIFI_DIRECT, "commandId=%{public}u", command->GetId());
std::lock_guard executorLock(executorLock_);
executor->SendEvent(command);
}
return ret;