[Nearby Cleanup] Remove dead code and unused includes.

PiperOrigin-RevId: 402933192
This commit is contained in:
suetfei
2021-10-13 15:13:11 -07:00
committed by Copybara-Service
parent 6ac98e6f4e
commit f20e7de4e7
3 changed files with 0 additions and 103 deletions
-2
View File
@@ -41,9 +41,7 @@
#include "platform/public/webrtc.h"
#include "proto/connections/offline_wire_formats.pb.h"
#include "proto/mediums/web_rtc_signaling_frames.pb.h"
#include "webrtc/api/data_channel_interface.h"
#include "webrtc/api/jsep.h"
#include "webrtc/api/scoped_refptr.h"
namespace location {
namespace nearby {
@@ -1358,99 +1358,6 @@ BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::WifiLanConnectImpl(
};
}
proto::connections::Medium
P2pClusterPcpHandler::StartListeningForWebRtcConnections(
ClientProxy* client, const std::string& service_id,
const std::string& local_endpoint_id,
const ByteArray& local_endpoint_info) {
if (!webrtc_medium_.IsAvailable()) {
return proto::connections::UNKNOWN_MEDIUM;
}
if (!webrtc_medium_.IsAcceptingConnections(service_id)) {
mediums::PeerId self_id = CreatePeerIdFromAdvertisement(
service_id, local_endpoint_id, local_endpoint_info);
std::string empty_country_code;
if (!webrtc_medium_.StartAcceptingConnections(
service_id, self_id, Utils::BuildLocationHint(empty_country_code),
{[this, client,
local_endpoint_info](mediums::WebRtcSocketWrapper socket) {
if (!socket.IsValid()) {
NEARBY_LOGS(WARNING)
<< "Invalid socket in accept callback("
<< absl::BytesToHexString(local_endpoint_info.data())
<< "), client=" << client->GetClientId();
return;
}
RunOnPcpHandlerThread(
"p2p-rtc-on-incoming-connection",
[this, client, socket = std::move(socket)]()
RUN_ON_PCP_HANDLER_THREAD() {
std::string remote_device_name = "WebRtcSocket";
auto channel = absl::make_unique<WebRtcEndpointChannel>(
remote_device_name, socket);
ByteArray remote_device_info{remote_device_name};
OnIncomingConnection(client, remote_device_info,
std::move(channel),
proto::connections::WEB_RTC);
});
}})) {
NEARBY_LOGS(WARNING) << "In StartListeningForWebRtcConnections("
<< absl::BytesToHexString(local_endpoint_info.data())
<< "), client=" << client->GetClientId()
<< " failed to start listening for incoming WebRTC "
"connections to service_id="
<< service_id;
return proto::connections::UNKNOWN_MEDIUM;
}
NEARBY_LOGS(VERBOSE)
<< "In StartListeningForWebRtcConnections("
<< absl::BytesToHexString(local_endpoint_info.data())
<< "), client=" << client->GetClientId()
<< " started listening for incoming WebRtc connections to service_id="
<< service_id;
}
return proto::connections::WEB_RTC;
}
BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::WebRtcConnectImpl(
ClientProxy* client, WebRtcEndpoint* webrtc_endpoint) {
std::string empty_country_code;
mediums::WebRtcSocketWrapper socket_wrapper = webrtc_medium_.Connect(
webrtc_endpoint->service_id, webrtc_endpoint->peer_id,
Utils::BuildLocationHint(empty_country_code),
client->GetCancellationFlag(webrtc_endpoint->endpoint_id));
if (!socket_wrapper.IsValid()) {
NEARBY_LOGS(ERROR)
<< "In WebRtcConnectImpl(), failed to connect to WebRTC device for "
"endpoint(id="
<< webrtc_endpoint->endpoint_id << ").";
return BasePcpHandler::ConnectImplResult{.status = {Status::kError}};
}
auto channel = absl::make_unique<WebRtcEndpointChannel>(
webrtc_endpoint->endpoint_id, socket_wrapper);
if (!channel) {
NEARBY_LOGS(ERROR) << "In WebRtcConnectImpl(), failed to create WebRTC "
"endpoint channel for endpoint(id="
<< webrtc_endpoint->endpoint_id << ").";
socket_wrapper.Close();
return BasePcpHandler::ConnectImplResult{.status = {Status::kError}};
}
NEARBY_LOGS(VERBOSE)
<< "Client created WebRTC endpoint channel to endpoint(id="
<< webrtc_endpoint->endpoint_id << ").";
return BasePcpHandler::ConnectImplResult{
.medium = proto::connections::Medium::WEB_RTC,
.status = {Status::kSuccess},
.endpoint_channel = std::move(channel)};
}
} // namespace connections
} // namespace nearby
} // namespace location
@@ -188,14 +188,6 @@ class P2pClusterPcpHandler : public BasePcpHandler {
BasePcpHandler::ConnectImplResult WifiLanConnectImpl(
ClientProxy* client, WifiLanEndpoint* endpoint);
// WebRtc
proto::connections::Medium StartListeningForWebRtcConnections(
ClientProxy* client, const std::string& service_id,
const std::string& local_endpoint_id,
const ByteArray& local_endpoint_info);
BasePcpHandler::ConnectImplResult WebRtcConnectImpl(
ClientProxy* client, WebRtcEndpoint* webrtc_endpoint);
BluetoothRadio& bluetooth_radio_;
BluetoothClassic& bluetooth_medium_;
Ble& ble_medium_;