Roll forward to cl/348050035.

This commit is contained in:
hai007
2020-12-17 10:44:17 -08:00
parent 599a015760
commit cebf022b28
6 changed files with 13 additions and 31 deletions
@@ -16,7 +16,6 @@ PeerConnectionObserverImpl::PeerConnectionObserverImpl(
void PeerConnectionObserverImpl::OnIceCandidate(
const webrtc::IceCandidateInterface* candidate) {
NEARBY_LOG(INFO, "OnIceCandidate");
local_ice_candidate_listener_.local_ice_candidate_found_cb(candidate);
}
@@ -137,12 +137,14 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl(
Status P2pClusterPcpHandler::StopAdvertisingImpl(ClientProxy* client) {
if (client->GetClientId() == bluetooth_classic_advertiser_client_id_) {
bluetooth_medium_.TurnOffDiscoverability();
bluetooth_classic_advertiser_client_id_ = 0;
} else {
NEARBY_LOG(INFO,
"Skipped BT TurnOffDiscoverability for client %d, client that "
"turned on discoverability is %d",
client->GetClientId(), bluetooth_classic_advertiser_client_id_);
}
bluetooth_medium_.StopAcceptingConnections(client->GetAdvertisingServiceId());
ble_medium_.StopAdvertising(client->GetAdvertisingServiceId());
@@ -621,12 +623,14 @@ Status P2pClusterPcpHandler::StopDiscoveryImpl(ClientProxy* client) {
wifi_lan_medium_.StopDiscovery(client->GetDiscoveryServiceId());
if (client->GetClientId() == bluetooth_classic_discoverer_client_id_) {
bluetooth_medium_.StopDiscovery();
bluetooth_classic_discoverer_client_id_ = 0;
} else {
NEARBY_LOG(INFO,
"Skipped BT stopDiscovery for client %d, client that started "
"discovery is %d",
client->GetClientId(), bluetooth_classic_discoverer_client_id_);
}
ble_medium_.StopScanning(client->GetDiscoveryServiceId());
return {Status::kSuccess};
}
+2 -2
View File
@@ -186,8 +186,8 @@ class P2pClusterPcpHandler : public BasePcpHandler {
WifiLan& wifi_lan_medium_;
mediums::WebRtc& webrtc_medium_;
InjectedBluetoothDeviceStore& injected_bluetooth_device_store_;
std::int64_t bluetooth_classic_discoverer_client_id_;
std::int64_t bluetooth_classic_advertiser_client_id_;
std::int64_t bluetooth_classic_discoverer_client_id_{0};
std::int64_t bluetooth_classic_advertiser_client_id_{0};
};
} // namespace connections
+3 -18
View File
@@ -34,13 +34,6 @@ bool PayloadManager::SendPayloadLoop(
EndpointsToEndpointIds(pair.first);
const Endpoints& unavailable_endpoints = pair.second;
NEARBY_LOG(INFO,
"SendPayloadLoop: Available: { %s }; Unavailable: { %s }; "
"payload_id=%" PRIX64 "; self=%p",
ToString(available_endpoint_ids).c_str(),
ToString(unavailable_endpoints).c_str(),
static_cast<Payload::Id>(payload_header.id()), this);
// First, handle any non-available endpoints.
for (const auto& endpoint : unavailable_endpoints) {
HandleFinishedOutgoingPayload(
@@ -143,8 +136,6 @@ PayloadManager::GetAvailableAndUnavailableEndpoints(
Endpoints available;
Endpoints unavailable;
for (auto* endpoint_info : pending_payload.GetEndpoints()) {
NEARBY_LOG(INFO, "EndpointInfo: %p; id=%s; status=%d", endpoint_info,
endpoint_info->id.c_str(), endpoint_info->status.Get());
if (endpoint_info->status.Get() ==
PayloadManager::EndpointInfo::Status::kAvailable) {
available.push_back(endpoint_info);
@@ -373,19 +364,15 @@ void PayloadManager::OnIncomingFrame(
ProcessControlPacket(to_client, from_endpoint_id, frame);
break;
case PayloadTransferFrame::DATA:
NEARBY_LOG(INFO, "PayloadManager::OnIncomingFrame [DATA]: self=%p; id=%s",
this, from_endpoint_id.c_str());
ProcessDataPacket(to_client, from_endpoint_id, frame);
break;
default:
NEARBY_LOG(
INFO,
WARNING,
"PayloadManager: invalid frame; remote endpoint: self=%p; id=%s",
this, from_endpoint_id.c_str());
break;
}
NEARBY_LOG(INFO, "PayloadManager::OnIncomingFrame [DONE]: self=%p; id=%s",
this, from_endpoint_id.c_str());
}
void PayloadManager::OnEndpointDisconnect(ClientProxy* client,
@@ -801,7 +788,7 @@ void PayloadManager::ProcessDataPacket(
} else {
pending_payload = GetPayload(payload_header.id());
if (!pending_payload) {
NEARBY_LOG(INFO,
NEARBY_LOG(WARNING,
"ProcessDataPacket: [missing] id=%s; payload_id=%" PRIX64,
from_endpoint_id.c_str(),
static_cast<std::int64_t>(payload_header.id()));
@@ -833,7 +820,7 @@ void PayloadManager::ProcessDataPacket(
if (pending_payload->GetInternalPayload()
->AttachNextChunk(ByteArray(std::move(*payload_chunk.mutable_body())))
.Raised()) {
NEARBY_LOG(INFO,
NEARBY_LOG(WARNING,
"ProcessDataPacket: [data: error] id=%s; payload_id=%" PRIX64,
from_endpoint_id.c_str(), pending_payload->GetId());
HandleFinishedIncomingPayload(
@@ -842,8 +829,6 @@ void PayloadManager::ProcessDataPacket(
return;
}
NEARBY_LOG(INFO, "ProcessDataPacket: [data: ok] id=%s; payload_id=%" PRIX64,
from_endpoint_id.c_str(), pending_payload->GetId());
HandleSuccessfulIncomingChunk(to_client, from_endpoint_id, payload_header,
payload_chunk.flags(), payload_chunk.offset(),
payload_body_size);
+2 -10
View File
@@ -37,18 +37,10 @@ bool BleMedium::StartScanning(
auto pair = peripherals_.emplace(
&peripheral, absl::make_unique<ScanningInfo>());
auto& context = *pair.first->second;
if (!pair.second) {
NEARBY_LOG(INFO,
"Discovering (again) peripheral=%p, impl=%p, "
"peripheral name=%s",
&context.peripheral, &peripheral,
peripheral.GetName().c_str());
} else {
if (pair.second) {
context.peripheral = BlePeripheral(&peripheral);
NEARBY_LOG(INFO,
"Discovering peripheral=%p, impl=%p, "
"peripheral name=%s",
&context.peripheral, &peripheral,
"Discovered peripheral '%s'",
peripheral.GetName().c_str());
discovered_peripheral_callback_.peripheral_discovered_cb(
context.peripheral, service_id,