summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-05 00:52:27 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-05 00:52:27 +0000
commit349bea08ba9f82ada9f21f1a3b773a630bf7fe28 (patch)
tree9ed11c40ec039383e496f67d560bfd49b44ab729 /remoting
parenta23cdc73bc97da5414166f46be92552798982b89 (diff)
downloadchromium_src-349bea08ba9f82ada9f21f1a3b773a630bf7fe28.zip
chromium_src-349bea08ba9f82ada9f21f1a3b773a630bf7fe28.tar.gz
chromium_src-349bea08ba9f82ada9f21f1a3b773a630bf7fe28.tar.bz2
React to error messages received in response to transport-info.
BUG=100822 TEST=client disconnects when host dies. Review URL: http://codereview.chromium.org/8437017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/protocol/pepper_session.cc24
-rw-r--r--remoting/protocol/pepper_session.h2
2 files changed, 23 insertions, 3 deletions
diff --git a/remoting/protocol/pepper_session.cc b/remoting/protocol/pepper_session.cc
index 6d8757c..cb039de 100644
--- a/remoting/protocol/pepper_session.cc
+++ b/remoting/protocol/pepper_session.cc
@@ -95,7 +95,7 @@ void PepperSession::OnSessionInitiateResponse(
if (type != "result") {
LOG(ERROR) << "Received error in response to session-initiate message: \""
<< response->Str()
- << "\" Terminating the session.";
+ << "\". Terminating the session.";
// TODO(sergeyu): There may be different reasons for error
// here. Parse the response stanza to find failure reason.
@@ -321,6 +321,22 @@ void PepperSession::AddLocalCandidate(const cricket::Candidate& candidate) {
}
}
+void PepperSession::OnTransportInfoResponse(const buzz::XmlElement* response) {
+ const std::string& type = response->Attr(buzz::QName("", "type"));
+ if (type != "result") {
+ LOG(ERROR) << "Received error in response to session-initiate message: \""
+ << response->Str()
+ << "\". Terminating the session.";
+
+ if (state_ == CONNECTING) {
+ OnError(PEER_IS_OFFLINE);
+ } else {
+ // Host has disconnected without sending session-terminate message.
+ CloseInternal(false);
+ }
+ }
+}
+
void PepperSession::OnDeleteChannel(PepperChannel* channel) {
ChannelsMap::iterator it = channels_.find(channel->name());
DCHECK_EQ(it->second, channel);
@@ -330,8 +346,10 @@ void PepperSession::OnDeleteChannel(PepperChannel* channel) {
void PepperSession::SendTransportInfo() {
JingleMessage message(peer_jid_, JingleMessage::TRANSPORT_INFO, session_id_);
message.candidates.swap(pending_candidates_);
- scoped_ptr<IqRequest> request(session_manager_->iq_sender()->SendIq(
- message.ToXml(), IqSender::ReplyCallback()));
+ transport_info_request_.reset(session_manager_->iq_sender()->SendIq(
+ message.ToXml(), base::Bind(
+ &PepperSession::OnTransportInfoResponse,
+ base::Unretained(this))));
}
void PepperSession::CreateChannels() {
diff --git a/remoting/protocol/pepper_session.h b/remoting/protocol/pepper_session.h
index 271d6c1..861ff8d 100644
--- a/remoting/protocol/pepper_session.h
+++ b/remoting/protocol/pepper_session.h
@@ -108,6 +108,7 @@ class PepperSession : public Session {
void OnDeleteChannel(PepperChannel* channel);
void SendTransportInfo();
+ void OnTransportInfoResponse(const buzz::XmlElement* response);
// Helper methods to create event and control channels.
// TODO(sergeyu): Remove these methods.
@@ -139,6 +140,7 @@ class PepperSession : public Session {
std::string receiver_token_;
scoped_ptr<IqRequest> initiate_request_;
+ scoped_ptr<IqRequest> transport_info_request_;
ChannelsMap channels_;