summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/base/js
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/webapp/base/js')
-rw-r--r--remoting/webapp/base/js/log_to_server.js16
-rw-r--r--remoting/webapp/base/js/server_log_entry.js8
2 files changed, 13 insertions, 11 deletions
diff --git a/remoting/webapp/base/js/log_to_server.js b/remoting/webapp/base/js/log_to_server.js
index e68a001..34d4db4 100644
--- a/remoting/webapp/base/js/log_to_server.js
+++ b/remoting/webapp/base/js/log_to_server.js
@@ -14,9 +14,11 @@ var remoting = remoting || {};
/**
* @param {remoting.SignalStrategy} signalStrategy Signal strategy.
+ * @param {boolean=} opt_isHost True if this instance should log role=host
+ * events rather than role=client.
* @constructor
*/
-remoting.LogToServer = function(signalStrategy) {
+remoting.LogToServer = function(signalStrategy, opt_isHost) {
/** @private */
this.statsAccumulator_ = new remoting.StatsAccumulator();
/** @private */
@@ -35,8 +37,10 @@ remoting.LogToServer = function(signalStrategy) {
this.hostVersion_ = '';
/** @private */
this.logEntryMode_ = remoting.ServerLogEntry.VALUE_MODE_UNKNOWN;
+ /** @private */
+ this.role_ = opt_isHost ? 'host' : 'client';
- this.setSessionId_();
+ this.setSessionId();
signalStrategy.sendConnectionSetupResults(this);
};
@@ -65,7 +69,7 @@ remoting.LogToServer.prototype.logClientSessionStateChange =
this.maybeExpireSessionId_();
// Log the session state change.
var entry = remoting.ServerLogEntry.makeClientSessionStateChange(
- state, connectionError, this.logEntryMode_);
+ state, connectionError, this.logEntryMode_, this.role_);
entry.addClientOSFields();
entry.addChromeVersionField();
entry.addWebappVersionField();
@@ -219,10 +223,8 @@ remoting.LogToServer.prototype.log_ = function(entry) {
/**
* Sets the session ID to a random string.
- *
- * @private
*/
-remoting.LogToServer.prototype.setSessionId_ = function() {
+remoting.LogToServer.prototype.setSessionId = function() {
this.sessionId_ = remoting.LogToServer.generateSessionId_();
this.sessionIdGenerationTime_ = new Date().getTime();
};
@@ -254,7 +256,7 @@ remoting.LogToServer.prototype.maybeExpireSessionId_ = function() {
this.logEntryMode_);
this.log_(entry);
// Generate a new session ID.
- this.setSessionId_();
+ this.setSessionId();
// Log the new session ID.
entry = remoting.ServerLogEntry.makeSessionIdNew(this.sessionId_,
this.logEntryMode_);
diff --git a/remoting/webapp/base/js/server_log_entry.js b/remoting/webapp/base/js/server_log_entry.js
index ec771a8..5f41155 100644
--- a/remoting/webapp/base/js/server_log_entry.js
+++ b/remoting/webapp/base/js/server_log_entry.js
@@ -222,13 +222,14 @@ remoting.ServerLogEntry.prototype.toDebugLog = function(indentLevel) {
* @param {remoting.ClientSession.State} state
* @param {!remoting.Error} connectionError
* @param {string} mode The current app mode (It2Me, Me2Me, AppRemoting).
+ * @param {string} role 'client' if the app is acting as a Chromoting client
+ * or 'host' if it is acting as a host (IT2Me)
* @return {remoting.ServerLogEntry}
*/
remoting.ServerLogEntry.makeClientSessionStateChange = function(state,
- connectionError, mode) {
+ connectionError, mode, role) {
var entry = new remoting.ServerLogEntry();
- entry.set_(remoting.ServerLogEntry.KEY_ROLE_,
- remoting.ServerLogEntry.VALUE_ROLE_CLIENT_);
+ entry.set_(remoting.ServerLogEntry.KEY_ROLE_, role);
entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_,
remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_);
entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_,
@@ -507,4 +508,3 @@ remoting.ServerLogEntry.prototype.addModeField = function(mode) {
remoting.ServerLogEntry.prototype.addApplicationId = function() {
this.set_(remoting.ServerLogEntry.KEY_APP_ID_, chrome.runtime.id);
};
-