Skip to content

Commit

Permalink
* Block the multiple indication of discovery-result
Browse files Browse the repository at this point in the history
* Fix the problems in NANCancelPublish by using the incorrect type and id

Signed-off-by: Lo,Chin-Ran <[email protected]>
  • Loading branch information
crlonxp committed Nov 11, 2024
1 parent 48a37b0 commit 6ba573e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/platform/Linux/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,9 +961,9 @@ CHIP_ERROR ConnectivityManagerImpl::_WiFiPAFCancelPublish()
{
GAutoPtr<GError> err;

ChipLogProgress(DeviceLayer, "WiFi-PAF: cancel publish_id: %d ! ", mpaf_info.peer_publish_id);
ChipLogProgress(DeviceLayer, "WiFi-PAF: cancel publish_id: %d ! ", mpaf_reply_info.publish_id);
std::lock_guard<std::mutex> lock(mWpaSupplicantMutex);
wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_publish_sync(mWpaSupplicant.iface, mpaf_info.peer_publish_id, nullptr,
wpa_fi_w1_wpa_supplicant1_interface_call_nancancel_publish_sync(mWpaSupplicant.iface, mpaf_reply_info.publish_id, nullptr,
&err.GetReceiver());
return CHIP_NO_ERROR;
}
Expand Down Expand Up @@ -1428,10 +1428,17 @@ void ConnectivityManagerImpl::OnDiscoveryResult(GVariant * discov_info)

GAutoPtr<GVariant> dataValue;
GVariant * value;
uint32_t subscribe_id;

value = g_variant_lookup_value(discov_info, "subscribe_id", G_VARIANT_TYPE_UINT32);
dataValue.reset(value);
g_variant_get(dataValue.get(), "u", &mpaf_info.subscribe_id);
g_variant_get(dataValue.get(), "u", &subscribe_id);
if (subscribe_id == mpaf_info.subscribe_id)
{
ChipLogError(DeviceLayer, "WiFi-PAF: subscribe_id: %u (reentrance)", subscribe_id);
return;
}
mpaf_info.subscribe_id = subscribe_id;

value = g_variant_lookup_value(discov_info, "publish_id", G_VARIANT_TYPE_UINT32);
dataValue.reset(value);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/dbus/wpa/DBusWpaInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<arg name="publish_id" type="i" direction="out" />
</method>
<method name="NANCancelPublish">
<arg name="nan_args" type="i" direction="in" />
<arg name="nan_args" type="u" direction="in" />
</method>
<method name="NANUpdatePublish">
<arg name="nan_args" type="a{sv}" direction="in" />
Expand Down

0 comments on commit 6ba573e

Please sign in to comment.