mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Deprecate enable_ipv6_dual_stack flag.
PiperOrigin-RevId: 844925341
This commit is contained in:
committed by
Copybara-Service
parent
d39ed48fe4
commit
b8d9389673
@@ -65,10 +65,6 @@ constexpr auto kEnableHotspotDhcpRenew =
|
||||
constexpr auto kEnableIntelPieSdk =
|
||||
flags::Flag<bool>(kConfigPackage, "45428547", false);
|
||||
|
||||
// Enable/Disable IPv6 dual stack support on Windows.
|
||||
constexpr auto kEnableIpv6DualStack =
|
||||
flags::Flag<bool>(kConfigPackage, "45733519", false);
|
||||
|
||||
// Enable/Disable use of IPv6 address from mDNS on Windows.
|
||||
constexpr auto kEnableMdnsIpv6 =
|
||||
flags::Flag<bool>(kConfigPackage, "45735181", false);
|
||||
|
||||
@@ -160,7 +160,7 @@ class WifiDirectServerSocket : public api::WifiDirectServerSocket {
|
||||
void SetIPAddress(std::string ip_address);
|
||||
|
||||
// Binds to local port
|
||||
bool Listen(int port, bool dual_stack);
|
||||
bool Listen(int port);
|
||||
|
||||
private:
|
||||
// Retrieves WifiDirect GO IP address from local machine
|
||||
|
||||
@@ -126,10 +126,7 @@ std::unique_ptr<api::WifiDirectSocket> WifiDirectMedium::ConnectToService(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
SocketAddress server_address(dual_stack);
|
||||
SocketAddress server_address(/*dual_stack=*/true);
|
||||
if (!server_address.FromString(server_address, remote_ip_address, port)) {
|
||||
LOG(ERROR) << "no valid service address and port to connect.";
|
||||
return nullptr;
|
||||
@@ -219,9 +216,6 @@ std::unique_ptr<api::WifiDirectServerSocket> WifiDirectMedium::ListenForService(
|
||||
// thread to avoid blocking BWU sending out of band upgrade frame to GC.
|
||||
listener_executor_.Execute([this, port]() mutable {
|
||||
absl::MutexLock lock(mutex_);
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
if (ip_address_local_.empty()) {
|
||||
if (server_socket_ptr_) {
|
||||
LOG(INFO) << "Waiting for IP address is ready.";
|
||||
@@ -247,7 +241,7 @@ std::unique_ptr<api::WifiDirectServerSocket> WifiDirectMedium::ListenForService(
|
||||
port = FeatureFlags::GetInstance().GetFlags().wifi_direct_default_port;
|
||||
}
|
||||
if (server_socket_ptr_ &&
|
||||
server_socket_ptr_->Listen(port, dual_stack)) {
|
||||
server_socket_ptr_->Listen(port)) {
|
||||
medium_status_ |= kMediumStatusAccepting;
|
||||
|
||||
// Setup close notifier after listen started.
|
||||
|
||||
@@ -107,10 +107,10 @@ Exception WifiDirectServerSocket::Close() {
|
||||
return {Exception::kSuccess};
|
||||
}
|
||||
|
||||
bool WifiDirectServerSocket::Listen(int port, bool dual_stack) {
|
||||
bool WifiDirectServerSocket::Listen(int port) {
|
||||
LOG(INFO) << "Listen wifi_direct on IP:port " << wifi_direct_ipaddr_ << ":"
|
||||
<< port;
|
||||
SocketAddress address(dual_stack);
|
||||
SocketAddress address(/*dual_stack=*/true);
|
||||
if (!SocketAddress::FromString(address, wifi_direct_ipaddr_, port)) {
|
||||
LOG(ERROR) << "Failed to parse wifi_direct IP address.";
|
||||
return false;
|
||||
|
||||
@@ -91,10 +91,7 @@ std::unique_ptr<api::WifiHotspotSocket> WifiHotspotMedium::ConnectToService(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
SocketAddress server_address(dual_stack);
|
||||
SocketAddress server_address(/*dual_stack=*/true);
|
||||
if (!server_address.FromBytes(server_address, service_address.address,
|
||||
service_address.port)) {
|
||||
LOG(ERROR) << "no valid service address and port to connect.";
|
||||
@@ -152,10 +149,7 @@ WifiHotspotMedium::ListenForService(int port) {
|
||||
auto server_socket = std::make_unique<WifiHotspotServerSocket>();
|
||||
server_socket_ptr_ = server_socket.get();
|
||||
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
if (server_socket->Listen(port, dual_stack)) {
|
||||
if (server_socket->Listen(port)) {
|
||||
medium_status_ |= kMediumStatusAccepting;
|
||||
|
||||
// Setup close notifier after listen started.
|
||||
|
||||
@@ -137,8 +137,8 @@ void WifiHotspotServerSocket::PopulateHotspotCredentials(
|
||||
hotspot_credentials.SetAddressCandidates(std::move(service_addresses));
|
||||
}
|
||||
|
||||
bool WifiHotspotServerSocket::Listen(int port, bool dual_stack) {
|
||||
SocketAddress address(dual_stack);
|
||||
bool WifiHotspotServerSocket::Listen(int port) {
|
||||
SocketAddress address(/*dual_stack=*/true);
|
||||
// Allow server socket to listen on all interfaces.
|
||||
// Consider sharing the same server socket for WifiLan medium.
|
||||
SocketAddress::FromString(address, "", port);
|
||||
|
||||
@@ -76,7 +76,7 @@ class WifiHotspotServerSocket : public api::WifiHotspotServerSocket {
|
||||
HotspotCredentials& hotspot_credentials) override;
|
||||
|
||||
// Binds to local port
|
||||
bool Listen(int port, bool dual_stack);
|
||||
bool Listen(int port);
|
||||
|
||||
private:
|
||||
// Retrieves hotspot IP address from local machine
|
||||
|
||||
@@ -141,7 +141,7 @@ class WifiLanServerSocket : public api::WifiLanServerSocket {
|
||||
}
|
||||
|
||||
// Binds to local port
|
||||
bool Listen(int port, bool dual_stack);
|
||||
bool Listen(int port);
|
||||
|
||||
private:
|
||||
NearbyServerSocket server_socket_;
|
||||
|
||||
@@ -347,10 +347,7 @@ std::unique_ptr<api::WifiLanSocket> WifiLanMedium::ConnectToService(
|
||||
const ServiceAddress& service_address,
|
||||
CancellationFlag* cancellation_flag) {
|
||||
LOG(INFO) << "ConnectToService is called.";
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
SocketAddress server_address(dual_stack);
|
||||
SocketAddress server_address(/*dual_stack=*/true);
|
||||
if (!server_address.FromServiceAddress(server_address, service_address)) {
|
||||
LOG(ERROR) << "no valid service address and port to connect.";
|
||||
return nullptr;
|
||||
@@ -404,10 +401,7 @@ std::unique_ptr<api::WifiLanServerSocket> WifiLanMedium::ListenForService(
|
||||
std::make_unique<WifiLanServerSocket>();
|
||||
WifiLanServerSocket* server_socket_ptr = server_socket.get();
|
||||
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
if (server_socket->Listen(port, dual_stack)) {
|
||||
if (server_socket->Listen(port)) {
|
||||
int port = server_socket_ptr->GetPort();
|
||||
LOG(INFO) << "started to listen serive on port: " << port;
|
||||
port_to_server_socket_map_.insert({port, server_socket_ptr});
|
||||
@@ -705,10 +699,7 @@ bool WifiLanMedium::IsConnectableIpAddress(NsdServiceInfo& nsd_service_info,
|
||||
absl::Duration timeout) {
|
||||
std::string ipv4_address = nsd_service_info.GetIPAddress();
|
||||
if (!ipv4_address.empty()) {
|
||||
bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag(
|
||||
platform::config_package_nearby::nearby_platform_feature::
|
||||
kEnableIpv6DualStack);
|
||||
SocketAddress service_address(dual_stack);
|
||||
SocketAddress service_address(/*dual_stack=*/true);
|
||||
if (SocketAddress::FromBytes(service_address, ipv4_address,
|
||||
nsd_service_info.GetPort())) {
|
||||
if (TestConnection(service_address, timeout)) {
|
||||
|
||||
@@ -59,9 +59,9 @@ std::unique_ptr<api::WifiLanSocket> WifiLanServerSocket::Accept() {
|
||||
return std::make_unique<WifiLanSocket>(std::move(client_socket));
|
||||
}
|
||||
|
||||
bool WifiLanServerSocket::Listen(int port, bool dual_stack) {
|
||||
bool WifiLanServerSocket::Listen(int port) {
|
||||
// Listen on all interfaces.
|
||||
SocketAddress address(dual_stack);
|
||||
SocketAddress address(/*dual_stack=*/true);
|
||||
SocketAddress::FromString(address, "", port);
|
||||
if (!server_socket_.Listen(address)) {
|
||||
LOG(ERROR) << "Failed to listen socket at port:" << port;
|
||||
|
||||
Reference in New Issue
Block a user