diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 04:18:15 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 04:18:15 +0000 |
commit | edb25feb5bbec764aa88f50105f120e593fbb34b (patch) | |
tree | 9d0403a01f06f15e9b1a1174b993ad92154f345a | |
parent | 7e1ceef44ff7114f06fa78154e6433071054ebfa (diff) | |
download | chromium_src-edb25feb5bbec764aa88f50105f120e593fbb34b.zip chromium_src-edb25feb5bbec764aa88f50105f120e593fbb34b.tar.gz chromium_src-edb25feb5bbec764aa88f50105f120e593fbb34b.tar.bz2 |
Revert 210731 "Host offline status reporting."
Broke the build: maybe base::Time was indirectly resolved but the indirection was gone?
http://build.chromium.org/p/chromium.linux/builders/Linux%20Builder/builds/10505/steps/compile/logs/stdio
../../remoting/host/host_status_sender_unittest.cc: In member function 'void remoting::HostStatusSenderTest::ValidateSignature(buzz::XmlElement*, remoting::HostStatusSender::HostStatus)':
../../remoting/host/host_status_sender_unittest.cc:195:40: error: 'base::Time' has not been declared
> Host offline status reporting.
>
> This is change #1 of the Host offline status reporting work:
> 1. Define the structure of the offline status message.
> 2. The host sends the offline status message if the underlying XMPP connection is live.
>
>
> BUG=247245
>
> Review URL: https://chromiumcodereview.appspot.com/18075003
TBR=weitaosu@chromium.org
Review URL: https://codereview.chromium.org/18357005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210737 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/host/host_exit_codes.cc | 28 | ||||
-rw-r--r-- | remoting/host/host_exit_codes.h | 1 | ||||
-rw-r--r-- | remoting/host/host_status_sender.cc | 161 | ||||
-rw-r--r-- | remoting/host/host_status_sender.h | 105 | ||||
-rw-r--r-- | remoting/host/host_status_sender_unittest.cc | 199 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 25 | ||||
-rw-r--r-- | remoting/host/server_log_entry.cc | 16 | ||||
-rw-r--r-- | remoting/host/server_log_entry.h | 6 | ||||
-rw-r--r-- | remoting/protocol/name_value_map.h | 4 | ||||
-rw-r--r-- | remoting/remoting.gyp | 5 |
10 files changed, 3 insertions, 547 deletions
diff --git a/remoting/host/host_exit_codes.cc b/remoting/host/host_exit_codes.cc deleted file mode 100644 index 4e206a5..0000000 --- a/remoting/host/host_exit_codes.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/host_exit_codes.h" - -#include "remoting/protocol/name_value_map.h" - -using remoting::protocol::NameMapElement; - -namespace remoting { - -const NameMapElement<HostExitCodes> kHostExitCodeStrings[] = { - { kSuccessExitCode, "SUCCESS_EXIT" }, - { kInitializationFailed, "INITIALIZATION_FAILED" }, - { kInvalidHostConfigurationExitCode, "INVALID_HOST_CONFIGURATION" }, - { kInvalidHostIdExitCode, "INVALID_HOST_ID" }, - { kInvalidOauthCredentialsExitCode, "INVALID_OAUTH_CREDENTIALS" }, - { kInvalidHostDomainExitCode, "INVALID_HOST_DOMAIN" }, - { kLoginScreenNotSupportedExitCode, "LOGIN_SCREEN_NOT_SUPPORTED" }, - { kUsernameMismatchExitCode, "USERNAME_MISMATCH" }, -}; - -const char* ExitCodeToString(HostExitCodes exit_code) { - return ValueToName(kHostExitCodeStrings, exit_code); -} - -} // namespace remoting diff --git a/remoting/host/host_exit_codes.h b/remoting/host/host_exit_codes.h index c45459b..b325d1f 100644 --- a/remoting/host/host_exit_codes.h +++ b/remoting/host/host_exit_codes.h @@ -33,7 +33,6 @@ enum HostExitCodes { kMaxPermanentErrorExitCode = kUsernameMismatchExitCode }; -const char* ExitCodeToString(HostExitCodes exit_code); } // namespace remoting #endif // REMOTING_HOST_HOST_EXIT_CODES_H_ diff --git a/remoting/host/host_status_sender.cc b/remoting/host/host_status_sender.cc deleted file mode 100644 index 75154cc..0000000 --- a/remoting/host/host_status_sender.cc +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/host_status_sender.h" - -#include "base/logging.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/stringize_macros.h" -#include "remoting/base/constants.h" -#include "remoting/host/server_log_entry.h" -#include "remoting/jingle_glue/iq_sender.h" -#include "remoting/jingle_glue/signal_strategy.h" -#include "third_party/libjingle/source/talk/xmllite/xmlelement.h" -#include "third_party/libjingle/source/talk/xmpp/constants.h" - -using buzz::QName; -using buzz::XmlElement; - -namespace remoting { - -namespace { - -const char kHostStatusTag[] = "host-status"; -const char kHostIdAttr[] = "hostid"; -const char kExitCodeAttr[] = "exit-code"; -const char kHostVersionTag[] = "host-version"; -const char kSignatureTag[] = "signature"; -const char kStatusAttr[] = "status"; -const char kSignatureTimeAttr[] = "time"; - -} // namespace - -const char* const HostStatusSender::host_status_strings_[] = -{"OFFLINE", "ONLINE"}; - -HostStatusSender::HostStatusSender( - const std::string& host_id, - SignalStrategy* signal_strategy, - scoped_refptr<RsaKeyPair> key_pair, - const std::string& directory_bot_jid) - : host_id_(host_id), - signal_strategy_(signal_strategy), - key_pair_(key_pair), - directory_bot_jid_(directory_bot_jid) { - DCHECK(signal_strategy_); - DCHECK(key_pair_.get()); - - signal_strategy_->AddListener(this); -} - -HostStatusSender::~HostStatusSender() { - signal_strategy_->RemoveListener(this); -} - -void HostStatusSender::OnSignalStrategyStateChange( - SignalStrategy::State state) { - if (state == SignalStrategy::CONNECTED) - iq_sender_.reset(new IqSender(signal_strategy_)); - else if (state == SignalStrategy::DISCONNECTED) - iq_sender_.reset(); -} - -bool HostStatusSender::OnSignalStrategyIncomingStanza( - const XmlElement* stanza) { - return false; -} - -void HostStatusSender::SendOfflineStatus(HostExitCodes exit_code) { - SendHostStatus(OFFLINE, exit_code); -} - -void HostStatusSender::SendOnlineStatus() { - SendHostStatus(ONLINE, kSuccessExitCode); -} - -void HostStatusSender::SendHostStatus(HostStatus status, - HostExitCodes exit_code) { - SignalStrategy::State state = signal_strategy_->GetState(); - if (state == SignalStrategy::CONNECTED) { - LOG(INFO) << "Sending host status '" - << HostStatusToString(status) - << "' to " - << directory_bot_jid_; - - iq_sender_->SendIq(buzz::STR_SET, - directory_bot_jid_, - CreateHostStatusMessage(status, exit_code), - IqSender::ReplyCallback()); - } else { - LOG(INFO) << "Cannot send host status to '" - << directory_bot_jid_ - << " ' because the state of the SignalStrategy is " - << state; - } -} - -scoped_ptr<XmlElement> HostStatusSender::CreateHostStatusMessage( - HostStatus status, HostExitCodes exit_code) { - // Create host status stanza. - scoped_ptr<XmlElement> host_status(new XmlElement( - QName(kChromotingXmlNamespace, kHostStatusTag))); - host_status->AddAttr( - QName(kChromotingXmlNamespace, kHostIdAttr), host_id_); - host_status->AddAttr( - QName(kChromotingXmlNamespace, kStatusAttr), HostStatusToString(status)); - - if (status == OFFLINE) { - host_status->AddAttr( - QName(kChromotingXmlNamespace, kExitCodeAttr), - ExitCodeToString(exit_code)); - } - - host_status->AddElement(CreateSignature(status, exit_code).release()); - - // Append host version. - scoped_ptr<XmlElement> version_tag(new XmlElement( - QName(kChromotingXmlNamespace, kHostVersionTag))); - version_tag->AddText(STRINGIZE(VERSION)); - host_status->AddElement(version_tag.release()); - - // Append log message (which isn't signed). - scoped_ptr<XmlElement> log(ServerLogEntry::MakeStanza()); - scoped_ptr<ServerLogEntry> log_entry( - ServerLogEntry::MakeForHostStatus(status, exit_code)); - log_entry->AddHostFields(); - log->AddElement(log_entry->ToStanza().release()); - host_status->AddElement(log.release()); - return host_status.Pass(); -} - -scoped_ptr<XmlElement> HostStatusSender::CreateSignature( - HostStatus status, HostExitCodes exit_code) { - scoped_ptr<XmlElement> signature_tag(new XmlElement( - QName(kChromotingXmlNamespace, kSignatureTag))); - - // Number of seconds since epoch (Jan 1, 1970). - int64 time = static_cast<int64>(base::Time::Now().ToDoubleT()); - std::string time_str(base::Int64ToString(time)); - - signature_tag->AddAttr( - QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); - - // Add a time stamp to the signature to prevent replay attacks. - std::string message = - signal_strategy_->GetLocalJid() + - " " + - time_str + - " " + - HostStatusToString(status); - - if (status == OFFLINE) - message += std::string(" ") + ExitCodeToString(exit_code); - - std::string signature(key_pair_->SignMessage(message)); - signature_tag->AddText(signature); - - return signature_tag.Pass(); -} - -} // namespace remoting diff --git a/remoting/host/host_status_sender.h b/remoting/host/host_status_sender.h deleted file mode 100644 index 3fa86b5..0000000 --- a/remoting/host/host_status_sender.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef REMOTING_HOST_STATUS_SENDER_H_ -#define REMOTING_HOST_STATUS_SENDER_H_ - -#include <string> - -#include "base/compiler_specific.h" -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "remoting/base/rsa_key_pair.h" -#include "remoting/host/host_exit_codes.h" -#include "remoting/jingle_glue/signal_strategy.h" - -namespace base { -class MessageLoopProxy; -} // namespace base - -namespace buzz { -class XmlElement; -} // namespace buzz - -namespace remoting { - -class RsaKeyPair; -class IqSender; - -// HostStatusSender sends the host status to the Chromoting Bot. -// Each host status stanza looks as follows: -// -// <cli:iq type="set" to="user@gmail.com/chromoting123123" -// id="123" xmlns:cli="jabber:client"> -// <rem:host-status rem:hostid="0" -// rem:status="OFFLINE" rem:exit-code="INVALID_HOST_CONFIGURATION" -// xmlns:rem="google:remoting"> -// <rem:signature rem:time="1372878097">.signature.</rem:signature> -// <rem:host-version>30.0.1554.0</rem:host-version> -// <rem:log><rem:entry cpu="x86_64" event-name="host-status" -// host-version="30.0.1560.0" os-name="Linux" role="host"/> -// </rem:log> -// </rem:host-status> -// </cli:iq> -// -// The signature is a base-64 encoded SHA-1 hash, signed with the host's -// private RSA key. The message being signed contains the full Jid (e.g. -// "user@gmail.com/chromoting123123"), the timestamp, the host status, -// and the exit code. -class HostStatusSender : SignalStrategy::Listener { - public: - - enum HostStatus { - OFFLINE = 0, - ONLINE = 1 - }; - - HostStatusSender(const std::string& host_id, - SignalStrategy* signal_strategy, - scoped_refptr<RsaKeyPair> key_pair, - const std::string& directory_bot_jid); - virtual ~HostStatusSender(); - - // SignalStrategy::Listener interface. - virtual void OnSignalStrategyStateChange( - SignalStrategy::State state) OVERRIDE; - virtual bool OnSignalStrategyIncomingStanza( - const buzz::XmlElement* stanza) OVERRIDE; - - // APIs for sending host status XMPP messages to the chromoting bot. - // status: the reason (exit code) why the host is offline. - void SendOnlineStatus(); - void SendOfflineStatus(HostExitCodes exit_code); - - inline static const char* HostStatusToString(HostStatus host_status) { - return host_status_strings_[host_status]; - } - - private: - // Helper method for sending either an online or an offline status message. - void SendHostStatus(HostStatus status, HostExitCodes exit_code); - - // Helper method to compose host status stanzas. - scoped_ptr<buzz::XmlElement> CreateHostStatusMessage( - HostStatus status, HostExitCodes exit_code); - - // Helper method to create the signature blob used in the host status stanza. - scoped_ptr<buzz::XmlElement> CreateSignature( - HostStatus status, HostExitCodes exit_code); - - std::string host_id_; - SignalStrategy* signal_strategy_; - scoped_refptr<RsaKeyPair> key_pair_; - std::string directory_bot_jid_; - scoped_ptr<IqSender> iq_sender_; - - // The string representation of the HostStatus values. - static const char* const host_status_strings_[2]; - - DISALLOW_COPY_AND_ASSIGN(HostStatusSender); -}; - -} // namespace remoting - -#endif // REMOTING_HOST_STATUS_SENDER_H_ diff --git a/remoting/host/host_status_sender_unittest.cc b/remoting/host/host_status_sender_unittest.cc deleted file mode 100644 index 4e55e73..0000000 --- a/remoting/host/host_status_sender_unittest.cc +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "remoting/host/host_status_sender.h" - -#include "base/strings/string_number_conversions.h" -#include "remoting/base/constants.h" -#include "remoting/base/rsa_key_pair.h" -#include "remoting/base/test_rsa_key_pair.h" -#include "remoting/host/host_exit_codes.h" -#include "remoting/jingle_glue/mock_objects.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/libjingle/source/talk/xmllite/xmlelement.h" - -using buzz::QName; -using buzz::XmlElement; - -using testing::DoAll; -using testing::NotNull; -using testing::Return; -using testing::SaveArg; - -namespace remoting { - -namespace { - -const char kTestBotJid[] = "remotingunittest@bot.talk.google.com"; -const char kHostId[] = "0"; -const char kTestJid[] = "user@gmail.com/chromoting123"; -const char kStanzaId[] = "123"; - -const HostExitCodes kTestExitCode = kInvalidHostConfigurationExitCode; -const char kTestExitCodeString[] = "INVALID_HOST_CONFIGURATION"; - -} // namespace - -class HostStatusSenderTest - : public testing::Test { - protected: - virtual void SetUp() OVERRIDE { - key_pair_ = RsaKeyPair::FromString(kTestRsaKeyPair); - ASSERT_TRUE(key_pair_.get()); - - host_status_sender_.reset(new HostStatusSender( - kHostId, &signal_strategy_, key_pair_, kTestBotJid)); - } - - virtual void TearDown() OVERRIDE { - host_status_sender_.reset(); - } - - void ValidateHostStatusStanza(XmlElement* stanza, - HostStatusSender::HostStatus status); - - void ValidateSignature( - XmlElement* signature, HostStatusSender::HostStatus status); - - MockSignalStrategy signal_strategy_; - scoped_refptr<RsaKeyPair> key_pair_; - scoped_ptr<HostStatusSender> host_status_sender_; -}; - -TEST_F(HostStatusSenderTest, SendOnlineStatus) { - XmlElement* sent_iq = NULL; - EXPECT_CALL(signal_strategy_, GetState()) - .WillOnce(Return(SignalStrategy::DISCONNECTED)) - .WillRepeatedly(Return(SignalStrategy::CONNECTED)); - EXPECT_CALL(signal_strategy_, GetLocalJid()) - .WillRepeatedly(Return(kTestJid)); - EXPECT_CALL(signal_strategy_, GetNextId()) - .WillOnce(Return(kStanzaId)); - EXPECT_CALL(signal_strategy_, SendStanzaPtr(NotNull())) - .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); - - // Call SendOnlineStatus twice. The first call should be a - // no-op because |signal_strategy_| is diconnected. - // So we expect SendStanza to be called only once. - host_status_sender_->SendOnlineStatus(); - - host_status_sender_->OnSignalStrategyStateChange( - SignalStrategy::CONNECTED); - host_status_sender_->SendOnlineStatus(); - - scoped_ptr<XmlElement> stanza(sent_iq); - - ASSERT_TRUE(stanza != NULL); - LOG(INFO) << stanza->Str(); - - ValidateHostStatusStanza(stanza.get(), HostStatusSender::ONLINE); -} - -TEST_F(HostStatusSenderTest, SendOfflineStatus) { - XmlElement* sent_iq = NULL; - EXPECT_CALL(signal_strategy_, GetState()) - .WillOnce(Return(SignalStrategy::DISCONNECTED)) - .WillRepeatedly(Return(SignalStrategy::CONNECTED)); - EXPECT_CALL(signal_strategy_, GetLocalJid()) - .WillRepeatedly(Return(kTestJid)); - EXPECT_CALL(signal_strategy_, GetNextId()) - .WillOnce(Return(kStanzaId)); - EXPECT_CALL(signal_strategy_, SendStanzaPtr(NotNull())) - .WillOnce(DoAll(SaveArg<0>(&sent_iq), Return(true))); - - // Call SendOfflineStatus twice. The first call should be a - // no-op because |signal_strategy_| is diconnected. - // So we expect SendStanza to be called only once. - host_status_sender_->SendOfflineStatus(kTestExitCode); - - host_status_sender_->OnSignalStrategyStateChange( - SignalStrategy::CONNECTED); - host_status_sender_->SendOfflineStatus(kTestExitCode); - - scoped_ptr<XmlElement> stanza(sent_iq); - - ASSERT_TRUE(stanza != NULL); - LOG(INFO) << stanza->Str(); - - ValidateHostStatusStanza(stanza.get(), HostStatusSender::OFFLINE); -} - -// Validate a host status stanza. -void HostStatusSenderTest::ValidateHostStatusStanza( - XmlElement* stanza, HostStatusSender::HostStatus status) { - EXPECT_EQ(stanza->Attr(QName(std::string(), "to")), - std::string(kTestBotJid)); - EXPECT_EQ(stanza->Attr(QName(std::string(), "type")), "set"); - - XmlElement* host_status_stanza = - stanza->FirstNamed(QName(kChromotingXmlNamespace, "host-status")); - ASSERT_TRUE(host_status_stanza != NULL); - - if (status == HostStatusSender::ONLINE) { - EXPECT_EQ("ONLINE", - host_status_stanza->Attr( - QName(kChromotingXmlNamespace, "status"))); - EXPECT_FALSE(host_status_stanza->HasAttr( - QName(kChromotingXmlNamespace, "exit-code"))); - } else { - EXPECT_EQ("OFFLINE", - host_status_stanza->Attr( - QName(kChromotingXmlNamespace, "status"))); - EXPECT_EQ(kTestExitCodeString, - host_status_stanza->Attr( - QName(kChromotingXmlNamespace, "exit-code"))); - } - - EXPECT_EQ(std::string(kHostId), - host_status_stanza->Attr( - QName(kChromotingXmlNamespace, "hostid"))); - - QName signature_tag(kChromotingXmlNamespace, "signature"); - XmlElement* signature = host_status_stanza->FirstNamed(signature_tag); - ASSERT_TRUE(signature != NULL); - EXPECT_TRUE(host_status_stanza->NextNamed(signature_tag) == NULL); - - ValidateSignature(signature, status); -} - -// Validate the signature. -void HostStatusSenderTest::ValidateSignature( - XmlElement* signature, HostStatusSender::HostStatus status) { - - EXPECT_TRUE(signature->HasAttr( - QName(kChromotingXmlNamespace, "time"))); - - std::string time_str = - signature->Attr(QName(kChromotingXmlNamespace, "time")); - - int64 time; - ASSERT_TRUE(base::StringToInt64(time_str, &time)); - - std::string message; - message += kTestJid; - message += " "; - message += time_str; - message += " "; - - if (status == HostStatusSender::OFFLINE) { - message += "OFFLINE"; - message += " "; - message += kTestExitCodeString; - } else { - message += "ONLINE"; - } - - scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::FromString(kTestRsaKeyPair); - ASSERT_TRUE(key_pair.get()); - - std::string expected_signature = - key_pair->SignMessage(message); - EXPECT_EQ(expected_signature, signature->BodyText()); - - int64 now = static_cast<int64>(base::Time::Now().ToDoubleT()); - LOG(INFO) << "SendHostStatus took " << now - time << " seconds."; -} - -} // namespace remoting diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 91b4606..25a4ef1 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -50,7 +50,6 @@ #include "remoting/host/host_event_logger.h" #include "remoting/host/host_exit_codes.h" #include "remoting/host/host_main.h" -#include "remoting/host/host_status_sender.h" #include "remoting/host/ipc_constants.h" #include "remoting/host/ipc_desktop_environment.h" #include "remoting/host/ipc_host_event_logger.h" @@ -222,9 +221,7 @@ class HostProcess void RestartHost(); // Stops the host and shuts down the process with the specified |exit_code|. - void ShutdownHost(HostExitCodes exit_code); - - void ScheduleHostShutdown(); + void ShutdownHost(int exit_code); void ShutdownOnNetworkThread(); @@ -275,7 +272,6 @@ class HostProcess scoped_ptr<XmppSignalStrategy> signal_strategy_; scoped_ptr<SignalingConnector> signaling_connector_; scoped_ptr<HeartbeatSender> heartbeat_sender_; - scoped_ptr<HostStatusSender> host_status_sender_; scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; scoped_ptr<LogToServer> log_to_server_; scoped_ptr<HostEventLogger> host_event_logger_; @@ -960,9 +956,6 @@ void HostProcess::StartHost() { this, host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_)); - host_status_sender_.reset(new HostStatusSender( - host_id_, signal_strategy_.get(), key_pair_, directory_bot_jid_)); - host_change_notification_listener_.reset(new HostChangeNotificationListener( this, host_id_, signal_strategy_.get(), directory_bot_jid_)); @@ -997,7 +990,7 @@ void HostProcess::RestartHost() { ShutdownOnNetworkThread(); } -void HostProcess::ShutdownHost(HostExitCodes exit_code) { +void HostProcess::ShutdownHost(int exit_code) { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); *exit_code_out_ = exit_code; @@ -1006,8 +999,7 @@ void HostProcess::ShutdownHost(HostExitCodes exit_code) { case HOST_INITIALIZING: case HOST_STARTED: state_ = HOST_STOPPING; - host_status_sender_->SendOfflineStatus(exit_code); - ScheduleHostShutdown(); + ShutdownOnNetworkThread(); break; case HOST_STOPPING_TO_RESTART: @@ -1021,16 +1013,6 @@ void HostProcess::ShutdownHost(HostExitCodes exit_code) { } } -// TODO(weitaosu): shut down the host once we get an ACK for the offline status -// XMPP message. -void HostProcess::ScheduleHostShutdown() { - // Delay the shutdown by 2 second to allow SendOfflineStatus to complete. - context_->network_task_runner()->PostDelayedTask( - FROM_HERE, - base::Bind(&HostProcess::ShutdownOnNetworkThread, base::Unretained(this)), - base::TimeDelta::FromSeconds(2)); -} - void HostProcess::ShutdownOnNetworkThread() { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); @@ -1038,7 +1020,6 @@ void HostProcess::ShutdownOnNetworkThread() { host_event_logger_.reset(); log_to_server_.reset(); heartbeat_sender_.reset(); - host_status_sender_.reset(); host_change_notification_listener_.reset(); signaling_connector_.reset(); signal_strategy_.reset(); diff --git a/remoting/host/server_log_entry.cc b/remoting/host/server_log_entry.cc index b13f6c6..f18b2378 100644 --- a/remoting/host/server_log_entry.cc +++ b/remoting/host/server_log_entry.cc @@ -26,7 +26,6 @@ const char kLogEntry[] = "entry"; const char kKeyEventName[] = "event-name"; const char kValueEventNameSessionState[] = "session-state"; const char kValueEventNameHeartbeat[] = "heartbeat"; -const char kValueEventNameHostStatus[] = "host-status"; const char kKeyRole[] = "role"; const char kValueRoleHost[] = "host"; @@ -39,9 +38,6 @@ const char kKeySessionState[] = "session-state"; const char kValueSessionStateConnected[] = "connected"; const char kValueSessionStateClosed[] = "closed"; -const char kStatusName[] = "status"; -const char kExitCodeName[] = "exit-code"; - const char kKeyOsName[] = "os-name"; const char kValueOsNameWindows[] = "Windows"; const char kValueOsNameLinux[] = "Linux"; @@ -88,18 +84,6 @@ scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHeartbeat() { return entry.Pass(); } -// static -scoped_ptr<ServerLogEntry> ServerLogEntry::MakeForHostStatus( - HostStatusSender::HostStatus host_status, HostExitCodes exit_code) { - scoped_ptr<ServerLogEntry> entry(new ServerLogEntry()); - entry->Set(kKeyRole, kValueRoleHost); - entry->Set(kKeyEventName, kValueEventNameHostStatus); - entry->Set(kStatusName, HostStatusSender::HostStatusToString(host_status)); - if (host_status == HostStatusSender::OFFLINE) - entry->Set(kExitCodeName, ExitCodeToString(exit_code)); - return entry.Pass(); -} - void ServerLogEntry::AddHostFields() { #if defined(OS_WIN) Set(kKeyOsName, kValueOsNameWindows); diff --git a/remoting/host/server_log_entry.h b/remoting/host/server_log_entry.h index ccaa850..3e8e68b 100644 --- a/remoting/host/server_log_entry.h +++ b/remoting/host/server_log_entry.h @@ -9,8 +9,6 @@ #include <string> #include "base/memory/scoped_ptr.h" -#include "remoting/host/host_exit_codes.h" -#include "remoting/host/host_status_sender.h" #include "remoting/protocol/transport.h" namespace buzz { @@ -39,10 +37,6 @@ class ServerLogEntry { // Constructs a log entry for a heartbeat. static scoped_ptr<ServerLogEntry> MakeForHeartbeat(); - // Constructs a log entry for a host status message. - static scoped_ptr<ServerLogEntry> MakeForHostStatus( - HostStatusSender::HostStatus host_status, HostExitCodes exit_code); - ~ServerLogEntry(); // Adds fields describing the host to this log entry. diff --git a/remoting/protocol/name_value_map.h b/remoting/protocol/name_value_map.h index 02e7bc3..79e8a47 100644 --- a/remoting/protocol/name_value_map.h +++ b/remoting/protocol/name_value_map.h @@ -4,10 +4,6 @@ // // Helper functions that allow to map enum values to strings. -#include <stddef.h> - -#include "base/logging.h" - namespace remoting { namespace protocol { diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 9885a4b..b57338e 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -408,14 +408,11 @@ 'host/dns_blackhole_checker.h', 'host/heartbeat_sender.cc', 'host/heartbeat_sender.h', - 'host/host_status_sender.cc', - 'host/host_status_sender.h', 'host/host_change_notification_listener.cc', 'host/host_change_notification_listener.h', 'host/host_config.cc', 'host/host_config.h', 'host/host_exit_codes.h', - 'host/host_exit_codes.cc', 'host/host_secret.cc', 'host/host_secret.h', 'host/host_status_monitor.h', @@ -1510,7 +1507,6 @@ 'host/desktop_session_win.cc', 'host/desktop_session_win.h', 'host/host_exit_codes.h', - 'host/host_exit_codes.cc', 'host/host_export.h', 'host/host_main.cc', 'host/host_main.h', @@ -2775,7 +2771,6 @@ 'host/desktop_session_agent.cc', 'host/desktop_session_agent.h', 'host/heartbeat_sender_unittest.cc', - 'host/host_status_sender_unittest.cc', 'host/host_change_notification_listener_unittest.cc', 'host/host_mock_objects.cc', 'host/host_mock_objects.h', |