Created
October 9, 2020 14:40
-
-
Save jasonLaster/29eaaea19f40003535355f5c6070ba90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/dispatch/control/controlInfo.js b/src/dispatch/control/controlInfo.js | |
| index 286e463..b89e9e6 100644 | |
| --- a/src/dispatch/control/controlInfo.js | |
| +++ b/src/dispatch/control/controlInfo.js | |
| @@ -34,15 +34,16 @@ class ControlInfo { | |
| // Unique ID for this controller. | |
| this.id = uuid(); | |
| this.gControl.set(this.id, this); | |
| - log(`CreateControl ${this.id}`); | |
| - | |
| - // Ask the host to create a controller to connect to the intranet server. | |
| - Host.spawnController(this.id, recordingId); | |
| // Recording the controller is processing. | |
| this.recordingId = recordingId; | |
| this.gControlByRecordingId.set(this.recordingId, this); | |
| + this.log(`ControlInfo::Create`); | |
| + | |
| + // Ask the host to create a controller to connect to the intranet server. | |
| + Host.spawnController(this.id, recordingId); | |
| + | |
| // Socket for communicating with the controller. | |
| this.controlSocket = null; | |
| @@ -76,16 +77,20 @@ class ControlInfo { | |
| this.sendMessage("setRecordingId", { recordingId }); | |
| } | |
| + log(msg, data) { | |
| + log(msg, { control: this.id, recording: this.recordingId, ...data }); | |
| + } | |
| + | |
| async ensureResourcesLoaded() { | |
| if (this.resourcesLoaded) { | |
| return; | |
| } | |
| this.resourcesLoaded = true; | |
| - log(`StartLoadResources ${this.id}`); | |
| + this.log(`ControlInfo::ensureResourcesLoaded start`); | |
| const contents = await getRecordingResources(this.recordingId); | |
| - log(`ForwardResources ${this.id}`); | |
| + this.log(`ControlInfo::ensureResourcesLoaded loaded`); | |
| this.sendMessage("resources", { contents }); | |
| } | |
| @@ -129,7 +134,7 @@ class ControlInfo { | |
| } | |
| destroy(why) { | |
| - log(`DestroyControl ${this.id} ${why}`); | |
| + this.log(`ControlInfo::Destroy`, { why }); | |
| if (this.controlSocket) { | |
| this.controlSocket.socket.close(); | |
| } | |
| diff --git a/src/dispatch/control/sessionInfo.js b/src/dispatch/control/sessionInfo.js | |
| index 84c5723..b3e68ab 100644 | |
| --- a/src/dispatch/control/sessionInfo.js | |
| +++ b/src/dispatch/control/sessionInfo.js | |
| @@ -23,6 +23,7 @@ class SessionInfo { | |
| destroy() { | |
| this.control.removeSession(this.id); | |
| + | |
| this.control.sendMessage("destroySession", { sessionId: this.id }); | |
| } | |
| diff --git a/src/dispatch/recording.js b/src/dispatch/recording.js | |
| index 6ba7707..41375ae 100644 | |
| --- a/src/dispatch/recording.js | |
| +++ b/src/dispatch/recording.js | |
| @@ -150,7 +150,7 @@ InProgressRecording.prototype = { | |
| ); | |
| this.uploaded = offset; | |
| - log(`UploadRecordingBuffer ${path} ${offset} ${length}`); | |
| + this.log(`UploadRecordingBuffer`, { path, offset, length }); | |
| return true; | |
| }, | |
| @@ -166,6 +166,10 @@ InProgressRecording.prototype = { | |
| await this.contentsFinished.promise; | |
| listener.onLength(this.uploaded); | |
| }, | |
| + | |
| + log(msg, data) { | |
| + log(msg, { recording: this.recordingId, ...data }); | |
| + }, | |
| }; | |
| function recordingPathSuffix(index) { | |
| @@ -366,7 +370,9 @@ const RecordingMessageHandlers = { | |
| "Internal.addRecordingData": async function ({ recordingId, offset, length }) { | |
| const buf = await this.socket.waitForBinaryMessage(); | |
| - log(`AddRecordingData ReceivedBinaryMessage MessageId ${this.id} RecordingId ${recordingId} Offset ${offset} Length ${length}`); | |
| + log( | |
| + `AddRecordingData ReceivedBinaryMessage MessageId ${this.id} RecordingId ${recordingId} Offset ${offset} Length ${length}` | |
| + ); | |
| if (!buf || buf.length != length) { | |
| this.reportError(Errors.BadDataBuffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment