summaryrefslogtreecommitdiffstats
path: root/remoting/jingle_glue/jingle_client.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 23:04:05 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 23:04:05 +0000
commitcdf8c57cbf1d997346e650fb5d0b301f7abc4dd4 (patch)
tree81a7bfd30b29dfaea9cd2644daf06f39d11b17a0 /remoting/jingle_glue/jingle_client.cc
parentc0035fff490b71ff952b97b6a3d22b1041689979 (diff)
downloadchromium_src-cdf8c57cbf1d997346e650fb5d0b301f7abc4dd4.zip
chromium_src-cdf8c57cbf1d997346e650fb5d0b301f7abc4dd4.tar.gz
chromium_src-cdf8c57cbf1d997346e650fb5d0b301f7abc4dd4.tar.bz2
Added HostKeyPair class, signatures for heartbeat messages.
BUG=None TEST=unittests Review URL: http://codereview.chromium.org/3087003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue/jingle_client.cc')
-rw-r--r--remoting/jingle_glue/jingle_client.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc
index 5287d77..a50ba71 100644
--- a/remoting/jingle_glue/jingle_client.cc
+++ b/remoting/jingle_glue/jingle_client.cc
@@ -2,10 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(ajwong): Check the initialization sentinels. Can we base it off of
-// state_ instead of a member variable? Also, we assign and read from a few of
-// the member variables on two threads. We need to audit this for thread
-// safety.
+// TODO(ajwong): We assign and read from a few of the member variables on
+// two threads. We need to audit this for thread safety.
#include "remoting/jingle_glue/jingle_client.h"
@@ -13,6 +11,7 @@
#include "base/waitable_event.h"
#include "base/message_loop.h"
#include "remoting/jingle_glue/gaia_token_pre_xmpp_auth.h"
+#include "remoting/jingle_glue/iq_request.h"
#include "remoting/jingle_glue/jingle_thread.h"
#include "remoting/jingle_glue/relay_port_allocator.h"
#include "remoting/jingle_glue/xmpp_socket_adapter.h"
@@ -32,13 +31,13 @@ namespace remoting {
JingleClient::JingleClient(JingleThread* thread)
: client_(NULL),
thread_(thread),
- state_(START),
+ state_(CREATED),
callback_(NULL) {
}
JingleClient::~JingleClient() {
// JingleClient can be destroyed only after it's closed.
- DCHECK(state_ == CLOSED);
+ DCHECK(state_ == CLOSED || state_ == CREATED);
}
void JingleClient::Init(
@@ -46,13 +45,13 @@ void JingleClient::Init(
const std::string& auth_token_service, Callback* callback) {
DCHECK_NE(username, "");
DCHECK(callback != NULL);
- DCHECK(callback_ == NULL); // Init() can be called only once.
+ DCHECK(state_ == CREATED);
callback_ = callback;
-
message_loop()->PostTask(
FROM_HERE, NewRunnableMethod(this, &JingleClient::DoInitialize,
username, auth_token, auth_token_service));
+ state_ = INITIALIZED;
}
JingleChannel* JingleClient::Connect(const std::string& host_jid,
@@ -160,6 +159,10 @@ std::string JingleClient::GetFullJid() {
return full_jid_;
}
+IqRequest* JingleClient::CreateIqRequest() {
+ return new IqRequest(this);
+}
+
MessageLoop* JingleClient::message_loop() {
return thread_->message_loop();
}
@@ -167,7 +170,7 @@ MessageLoop* JingleClient::message_loop() {
void JingleClient::OnConnectionStateChanged(buzz::XmppEngine::State state) {
switch (state) {
case buzz::XmppEngine::STATE_START:
- UpdateState(START);
+ UpdateState(INITIALIZED);
break;
case buzz::XmppEngine::STATE_OPENING:
UpdateState(CONNECTING);