mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Merge branch 'google3'
Change-Id: I99e72f30bb4b8f975d61a940a7c7b746dba07796
This commit is contained in:
@@ -30,11 +30,11 @@ BwuManager::BwuManager(
|
||||
if (config_.bandwidth_upgrade_retry_delay == absl::ZeroDuration()) {
|
||||
config_.bandwidth_upgrade_retry_delay = absl::Seconds(5);
|
||||
}
|
||||
if (config_.bandwidth_upgrade_retry_delay == absl::ZeroDuration()) {
|
||||
config_.bandwidth_upgrade_retry_delay = absl::Seconds(10);
|
||||
if (config_.bandwidth_upgrade_retry_max_delay == absl::ZeroDuration()) {
|
||||
config_.bandwidth_upgrade_retry_max_delay = absl::Seconds(10);
|
||||
}
|
||||
if (config_.allow_upgrade_to.All(false)) {
|
||||
config.allow_upgrade_to.web_rtc = true;
|
||||
config_.allow_upgrade_to.web_rtc = true;
|
||||
}
|
||||
if (!handlers.empty()) {
|
||||
handlers_ = std::move(handlers);
|
||||
@@ -43,7 +43,7 @@ BwuManager::BwuManager(
|
||||
}
|
||||
|
||||
// Register the offline frame processor.
|
||||
endpoint_manager.RegisterFrameProcessor(
|
||||
endpoint_manager_->RegisterFrameProcessor(
|
||||
V1Frame::BANDWIDTH_UPGRADE_NEGOTIATION, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,9 @@ ExceptionOr<bool> EndpointManager::HandleData(
|
||||
// no explicit handler.
|
||||
if (frame_type == V1Frame::KEEP_ALIVE) {
|
||||
NEARBY_LOG(INFO, "KeepAlive message for: id=%s", endpoint_id.c_str());
|
||||
} else if (frame_type == V1Frame::DISCONNECTION) {
|
||||
NEARBY_LOG(INFO, "Disconnect message for: id=%s", endpoint_id.c_str());
|
||||
endpoint_channel->Close();
|
||||
} else {
|
||||
NEARBY_LOG(ERROR, "Unhandled message: id=%s, type=%d",
|
||||
endpoint_id.c_str(), frame_type);
|
||||
|
||||
@@ -254,6 +254,17 @@ ByteArray ForKeepAlive() {
|
||||
return ToBytes(std::move(frame));
|
||||
}
|
||||
|
||||
ByteArray ForDisconnection() {
|
||||
OfflineFrame frame;
|
||||
|
||||
frame.set_version(OfflineFrame::V1);
|
||||
auto* v1_frame = frame.mutable_v1();
|
||||
v1_frame->set_type(V1Frame::DISCONNECTION);
|
||||
v1_frame->mutable_disconnection();
|
||||
|
||||
return ToBytes(std::move(frame));
|
||||
}
|
||||
|
||||
UpgradePathInfo::Medium MediumToUpgradePathInfoMedium(Medium medium) {
|
||||
switch (medium) {
|
||||
case Medium::MDNS:
|
||||
|
||||
@@ -13,9 +13,18 @@ P2pPointToPointPcpHandler::P2pPointToPointPcpHandler(
|
||||
std::vector<proto::connections::Medium>
|
||||
P2pPointToPointPcpHandler::GetConnectionMediumsByPriority() {
|
||||
std::vector<proto::connections::Medium> mediums;
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWebRtc().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WEB_RTC);
|
||||
}
|
||||
if (mediums_->GetBluetoothClassic().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::BLUETOOTH);
|
||||
}
|
||||
if (mediums_->GetBle().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::BLE);
|
||||
}
|
||||
return mediums;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,18 @@ P2pStarPcpHandler::P2pStarPcpHandler(Mediums& mediums,
|
||||
std::vector<proto::connections::Medium>
|
||||
P2pStarPcpHandler::GetConnectionMediumsByPriority() {
|
||||
std::vector<proto::connections::Medium> mediums;
|
||||
if (mediums_->GetWifiLan().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WIFI_LAN);
|
||||
}
|
||||
if (mediums_->GetWebRtc().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::WEB_RTC);
|
||||
}
|
||||
if (mediums_->GetBluetoothClassic().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::BLUETOOTH);
|
||||
}
|
||||
if (mediums_->GetBle().IsAvailable()) {
|
||||
mediums.push_back(proto::connections::BLE);
|
||||
}
|
||||
return mediums;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,6 +207,7 @@ message BandwidthUpgradeNegotiationFrame {
|
||||
// Accompanies Medium.WEB_RTC
|
||||
message WebRtcCredentials {
|
||||
optional string peer_id = 1;
|
||||
optional LocationHint location_hint = 2;
|
||||
}
|
||||
|
||||
optional Medium medium = 1;
|
||||
@@ -261,3 +262,29 @@ message MediumMetadata {
|
||||
// WiFi Lan BSSID
|
||||
optional string bssid = 2;
|
||||
}
|
||||
|
||||
// LocationHint is used to specify a location as well as format.
|
||||
message LocationHint {
|
||||
// Location is the location, provided in the format specified by format.
|
||||
optional string location = 1;
|
||||
|
||||
// the format of location.
|
||||
optional LocationStandard.Format format = 2;
|
||||
}
|
||||
|
||||
// Copy from
|
||||
// https://source.corp.google.com/piper///depot/google3/media/webrtc/server/tachyon/proto/tachyon_enums.proto;rcl=334271491;l=10242
|
||||
// These numbers match must match the original definition.
|
||||
message LocationStandard {
|
||||
enum Format {
|
||||
UNKNOWN = 0;
|
||||
// E164 country codes:
|
||||
// https://en.wikipedia.org/wiki/List_of_country_calling_codes
|
||||
// e.g. +1 for USA
|
||||
E164_CALLING = 1;
|
||||
|
||||
// ISO 3166-1 alpha-2 country codes:
|
||||
// https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
ISO_3166_1_ALPHA_2 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ enum PayloadStatus {
|
||||
REMOTE_CANCELLATION = 8;
|
||||
}
|
||||
|
||||
// next_id: 17
|
||||
// next_id: 18
|
||||
// Result of an upgrade attempt.
|
||||
enum BandwidthUpgradeResult {
|
||||
UNKNOWN_BANDWIDTH_UPGRADE_RESULT = 0;
|
||||
@@ -176,9 +176,6 @@ enum BandwidthUpgradeResult {
|
||||
// record analytics (e.g. the client disconnected).
|
||||
UNFINISHED_ERROR = 10;
|
||||
|
||||
// TODO(b/151833661): add a REMOTE_ERROR when we implement a cancellation
|
||||
// message, for the case when the remote endpoint had an error on their end.
|
||||
|
||||
// Error during setting up Bluetooth.
|
||||
BLUETOOTH_MEDIUM_ERROR = 11;
|
||||
|
||||
@@ -196,6 +193,9 @@ enum BandwidthUpgradeResult {
|
||||
|
||||
// Error during setting up WebRTC.
|
||||
WEB_RTC_MEDIUM_ERROR = 16;
|
||||
|
||||
// When the remote endpoint had an error on their end.
|
||||
RESULT_REMOTE_ERROR = 17;
|
||||
}
|
||||
|
||||
// next_id: 35
|
||||
@@ -217,6 +217,8 @@ enum BandwidthUpgradeErrorStage {
|
||||
UPGRADE_UNFINISHED = 7;
|
||||
// Upgrade successfully
|
||||
UPGRADE_SUCCESS = 8;
|
||||
// Upgrade cancel
|
||||
UPGRADE_CANCEL = 9;
|
||||
|
||||
// Medium-specific stages.
|
||||
// TODO(xlythe) Make sure each stage maps to one, and only one, possible
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ def copy_files_to_oss_project(src_root, dst_root):
|
||||
def detect_file_copy_header_options(fname, lines):
|
||||
if not lines:
|
||||
return None # ignore empty file
|
||||
suffixes = [".cc", ".cpp", ".cxx", ".c", ".h", ".hpp", ".inc", ".proto"]
|
||||
suffixes = [".cc", ".cpp", ".cxx", ".c", ".h", ".hpp", ".inc", ".mm", ".proto"]
|
||||
for suffix in suffixes:
|
||||
if fname.endswith(suffix):
|
||||
return ("//", 0)
|
||||
|
||||
Reference in New Issue
Block a user