Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: webrtc/p2p/base/relayserver.cc

Issue 1848083002: Change the size of the ICE ufrag to 4 bytes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: git status Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/p2pconstants.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/relayserver.cc
diff --git a/webrtc/p2p/base/relayserver.cc b/webrtc/p2p/base/relayserver.cc
index e098cbcd843b5f5e0d99c2513a9e3dd7c5d704d8..37b3371bf753f25446891bb6c66ffaa30aa46cbf 100644
--- a/webrtc/p2p/base/relayserver.cc
+++ b/webrtc/p2p/base/relayserver.cc
@@ -26,9 +26,6 @@ namespace cricket {
// By default, we require a ping every 90 seconds.
const int MAX_LIFETIME = 15 * 60 * 1000;
-// The number of bytes in each of the usernames we use.
-const uint32_t USERNAME_LENGTH = 16;
-
// Calls SendTo on the given socket and logs any bad results.
void Send(rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
const rtc::SocketAddress& addr) {
@@ -263,11 +260,14 @@ void RelayServer::OnExternalPacket(
return;
}
- uint32_t length =
- std::min(static_cast<uint32_t>(username_attr->length()), USERNAME_LENGTH);
+ uint32_t length = static_cast<uint32_t>(username_attr->length());
std::string username(username_attr->bytes(), length);
+ // The username is the substring before colon in username_attr
+ std::string::size_type colonpos = username.find(':');
+ if (colonpos != std::string::npos) {
+ username = username.substr(0, colonpos);
pthatcher1 2016/05/05 18:07:19 I don't think this is correct. The place where we
Zhi Huang 2016/05/05 18:27:09 The reason I made these changes is some unit tests
pthatcher1 2016/05/05 20:24:31 I don't see why a length of 9 would cause this cod
Zhi Huang 2016/05/05 23:10:59 I changed code like this: const uint32_t USERNAME
pthatcher1 2016/05/09 23:59:25 uint32_t length = static_cast<uint32_t>(username_a
+ }
// TODO: Check the HMAC.
-
// The binding should already be present.
BindingMap::iterator biter = bindings_.find(username);
if (biter == bindings_.end()) {
« no previous file with comments | « webrtc/p2p/base/p2pconstants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698