Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: remoting/host/log_to_server.cc

Issue 10413035: [Chromoting] LogToServer correctly handles multiple simultaneous connections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/log_to_server.cc
diff --git a/remoting/host/log_to_server.cc b/remoting/host/log_to_server.cc
index 723b70994484605328dd2d78361909143811c6b9..e22e6f4fa0b8b385b47b975547fa5d3f03c68e8c 100644
--- a/remoting/host/log_to_server.cc
+++ b/remoting/host/log_to_server.cc
@@ -30,8 +30,7 @@ LogToServer::LogToServer(ChromotingHost* host,
SignalStrategy* signal_strategy)
: host_(host),
mode_(mode),
- signal_strategy_(signal_strategy),
- connection_type_set_(false) {
+ signal_strategy_(signal_strategy) {
signal_strategy_->AddListener(this);
// |host| may be NULL in tests.
@@ -45,7 +44,8 @@ LogToServer::~LogToServer() {
host_->RemoveStatusObserver(this);
}
-void LogToServer::LogSessionStateChange(bool connected) {
+void LogToServer::LogSessionStateChange(const std::string& jid,
+ bool connected) {
DCHECK(CalledOnValidThread());
scoped_ptr<ServerLogEntry> entry(
@@ -54,8 +54,8 @@ void LogToServer::LogSessionStateChange(bool connected) {
entry->AddModeField(mode_);
if (connected) {
- DCHECK(connection_type_set_);
- entry->AddConnectionTypeField(connection_type_);
+ DCHECK(connection_info_[jid].get_route_type_set());
+ entry->AddConnectionTypeField(connection_info_[jid].get_route_type());
}
Log(*entry.get());
}
@@ -73,13 +73,13 @@ void LogToServer::OnSignalStrategyStateChange(SignalStrategy::State state) {
void LogToServer::OnClientAuthenticated(const std::string& jid) {
DCHECK(CalledOnValidThread());
- LogSessionStateChange(true);
+ LogSessionStateChange(jid, true);
}
void LogToServer::OnClientDisconnected(const std::string& jid) {
DCHECK(CalledOnValidThread());
- LogSessionStateChange(false);
- connection_type_set_ = false;
+ LogSessionStateChange(jid, false);
+ connection_info_.erase(jid);
}
void LogToServer::OnAccessDenied(const std::string& jid) {
@@ -91,8 +91,7 @@ void LogToServer::OnClientRouteChange(const std::string& jid,
// Store connection type for the video channel. It is logged later
// when client authentication is finished.
if (channel_name == kVideoChannelName) {
- connection_type_ = route.type;
- connection_type_set_ = true;
+ connection_info_[jid].set_route_type(route.type);
}
}
@@ -127,4 +126,22 @@ void LogToServer::SendPendingEntries() {
return;
}
+LogToServer::ConnectionInfo::ConnectionInfo() : route_type_set_(false) {
+}
+
+void LogToServer::ConnectionInfo::set_route_type(
+ const protocol::TransportRoute::RouteType& route_type) {
+ route_type_ = route_type;
+ route_type_set_ = true;
+}
+
+protocol::TransportRoute::RouteType
+LogToServer::ConnectionInfo::get_route_type() const {
+ return route_type_;
+}
+
+bool LogToServer::ConnectionInfo::get_route_type_set() const {
+ return route_type_set_;
+}
+
} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698