mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
nearbyconnections : Implement WifiLanV2 BandwidthUpgrade functions.
PiperOrigin-RevId: 405821802
This commit is contained in:
committed by
Copybara-Service
parent
7197b84e4d
commit
57ee5f10a4
@@ -245,7 +245,7 @@ class MediumEnvironment {
|
||||
api::WifiLanSocket& socket,
|
||||
const std::string& service_id);
|
||||
|
||||
// Returns WiFi LAN service matching IP address and port, or nullptr.
|
||||
// Returns WifiLan service matching IP address and port, or nullptr.
|
||||
api::WifiLanService* GetWifiLanService(const std::string& ip_address,
|
||||
int port);
|
||||
|
||||
@@ -278,7 +278,8 @@ class MediumEnvironment {
|
||||
// Removes medium-related info. This should correspond to device power off.
|
||||
void UnregisterWifiLanMediumV2(api::WifiLanMediumV2& medium);
|
||||
|
||||
// Returns WiFi LAN service matching IP address and port, or nullptr.
|
||||
// Returns WifiLan medium whose advertising service matching IP address and
|
||||
// port, or nullptr.
|
||||
api::WifiLanMediumV2* GetWifiLanV2Medium(const std::string& ip_address,
|
||||
int port);
|
||||
|
||||
|
||||
@@ -293,9 +293,9 @@ std::unique_ptr<api::WifiLanSocketV2> WifiLanMediumV2::ConnectToService(
|
||||
std::unique_ptr<api::WifiLanSocketV2> WifiLanMediumV2::ConnectToService(
|
||||
const std::string& ip_address, int port,
|
||||
CancellationFlag* cancellation_flag) {
|
||||
std::string socket_name = WifiLanServerSocketV2::GetName(ip_address, port);
|
||||
NEARBY_LOGS(INFO) << "G3 WifiLan ConnectToService [self]: medium=" << this
|
||||
<< ", ip address + port="
|
||||
<< WifiLanServerSocketV2::GetName(ip_address, port);
|
||||
<< ", ip address + port=" << socket_name;
|
||||
// First, find an instance of remote medium, that exposed this service.
|
||||
auto& env = MediumEnvironment::Instance();
|
||||
auto* remote_medium =
|
||||
@@ -306,10 +306,9 @@ std::unique_ptr<api::WifiLanSocketV2> WifiLanMediumV2::ConnectToService(
|
||||
|
||||
WifiLanServerSocketV2* server_socket = nullptr;
|
||||
NEARBY_LOGS(INFO) << "G3 WifiLan ConnectToService [peer]: medium="
|
||||
<< remote_medium << ", remote ip address + port="
|
||||
<< WifiLanServerSocketV2::GetName(ip_address, port);
|
||||
<< remote_medium
|
||||
<< ", remote ip address + port=" << socket_name;
|
||||
// Then, find our server socket context in this medium.
|
||||
std::string socket_name = WifiLanServerSocketV2::GetName(ip_address, port);
|
||||
{
|
||||
absl::MutexLock medium_lock(&remote_medium->mutex_);
|
||||
auto item = remote_medium->server_sockets_.find(socket_name);
|
||||
|
||||
Reference in New Issue
Block a user