Index: remoting/host/register_support_host_request.cc |
diff --git a/remoting/host/register_support_host_request.cc b/remoting/host/register_support_host_request.cc |
index 338513d2e2e05535c3217dcd84f5c2f375d3dd8f..5974675de7c512ad40d6797386a80c1a04f7cd54 100644 |
--- a/remoting/host/register_support_host_request.cc |
+++ b/remoting/host/register_support_host_request.cc |
@@ -11,7 +11,7 @@ |
#include "base/time.h" |
#include "remoting/base/constants.h" |
#include "remoting/host/host_config.h" |
-#include "remoting/jingle_glue/iq_request.h" |
+#include "remoting/jingle_glue/iq_sender.h" |
#include "remoting/jingle_glue/jingle_thread.h" |
#include "remoting/jingle_glue/signal_strategy.h" |
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
@@ -59,12 +59,11 @@ void RegisterSupportHostRequest::OnSignallingConnected( |
message_loop_ = MessageLoop::current(); |
- request_.reset(signal_strategy->CreateIqRequest()); |
- request_->set_callback(base::Bind( |
- &RegisterSupportHostRequest::ProcessResponse, base::Unretained(this))); |
- |
- request_->SendIq(IqRequest::MakeIqStanza( |
- buzz::STR_SET, kChromotingBotJid, CreateRegistrationRequest(jid))); |
+ iq_sender_.reset(new IqSender(signal_strategy)); |
+ request_.reset(iq_sender_->SendIq( |
+ buzz::STR_SET, kChromotingBotJid, CreateRegistrationRequest(jid), |
+ base::Bind(&RegisterSupportHostRequest::ProcessResponse, |
+ base::Unretained(this)))); |
} |
void RegisterSupportHostRequest::OnSignallingDisconnected() { |
@@ -78,6 +77,7 @@ void RegisterSupportHostRequest::OnSignallingDisconnected() { |
} |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
request_.reset(); |
+ iq_sender_.reset(); |
} |
// Ignore any notifications other than signalling |
@@ -129,7 +129,10 @@ bool RegisterSupportHostRequest::ParseResponse(const XmlElement* response, |
} |
// This method must only be called for error or result stanzas. |
- DCHECK_EQ(std::string(buzz::STR_RESULT), type); |
+ if (type != buzz::STR_RESULT) { |
+ LOG(ERROR) << "Received unexpect stanza of type \"" << type << "\""; |
+ return false; |
+ } |
const XmlElement* result_element = response->FirstNamed(QName( |
kChromotingXmlNamespace, kRegisterQueryResultTag)); |