Commit 3553fe8c authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Call talk_base::InitializeSSL() in the remoting client

Previously the client was calling EnsureSSLServerSockets(), which
internally calls EnsureNSSSSLInit(). It's not necessary to initialize
server socket so that call was removed in r263951, and NSS is no longer
initialized, which sometimes breaks the client (see the bug). Also
removed the workaround.

BUG=364689

Review URL: https://codereview.chromium.org/297863005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272789 0039d316-1c4b-4281-b951-d872f2087c98
parent 6587aa7f
......@@ -54,6 +54,7 @@
#include "remoting/protocol/host_stub.h"
#include "remoting/protocol/libjingle_transport_factory.h"
#include "third_party/libjingle/source/talk/base/helpers.h"
#include "third_party/libjingle/source/talk/base/ssladapter.h"
#include "url/gurl.h"
// Windows defines 'PostMessage', so we have to undef it.
......@@ -245,7 +246,9 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
char random_seed[kRandomSeedSize];
crypto::RandBytes(random_seed, sizeof(random_seed));
talk_base::InitRandom(random_seed, sizeof(random_seed));
#endif // defined(USE_OPENSSL)
#elif defined(USE_NSS)
talk_base::InitializeSSL();
#endif // defined(USE_NSS)
// Send hello message.
scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
......
......@@ -4,9 +4,7 @@
#include "remoting/protocol/libjingle_transport_factory.h"
#include "base/base64.h"
#include "base/callback.h"
#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/timer/timer.h"
......@@ -45,20 +43,6 @@ const int kReconnectDelaySeconds = 15;
// Get fresh STUN/Relay configuration every hour.
const int kJingleInfoUpdatePeriodSeconds = 3600;
// TODO(sergeyu): Remove this function and use talk_base::CreateRandomString()
// when it's fixed to work reliably. See crbug.com/364689 .
std::string CreateRandomString(int length) {
// Number of random bytes to generate base64 string at least |length|
// characters long.
int raw_length = (length + 1) * 3 / 4;
std::string base64;
base::Base64Encode(base::RandBytesAsString(raw_length), &base64);
DCHECK(static_cast<int>(base64.size()) == length ||
static_cast<int>(base64.size()) == length + 1);
base64.resize(length);
return base64;
}
class LibjingleStreamTransport
: public StreamTransport,
public base::SupportsWeakPtr<LibjingleStreamTransport>,
......@@ -141,8 +125,9 @@ LibjingleStreamTransport::LibjingleStreamTransport(
: port_allocator_(port_allocator),
network_settings_(network_settings),
event_handler_(NULL),
ice_username_fragment_(CreateRandomString(cricket::ICE_UFRAG_LENGTH)),
ice_password_(CreateRandomString(cricket::ICE_PWD_LENGTH)),
ice_username_fragment_(
talk_base::CreateRandomString(cricket::ICE_UFRAG_LENGTH)),
ice_password_(talk_base::CreateRandomString(cricket::ICE_PWD_LENGTH)),
can_start_(false),
channel_was_writable_(false),
connect_attempts_left_(kMaxReconnectAttempts) {
......@@ -385,7 +370,7 @@ void LibjingleStreamTransport::TryReconnect() {
--connect_attempts_left_;
// Restart ICE by resetting ICE password.
ice_password_ = CreateRandomString(cricket::ICE_PWD_LENGTH);
ice_password_ = talk_base::CreateRandomString(cricket::ICE_PWD_LENGTH);
channel_->SetIceCredentials(ice_username_fragment_, ice_password_);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment