Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra logging to PythonTestServer data received before parsed as json #22265

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/client/testing/testController/common/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class PythonTestServer implements ITestServer, Disposable {
this.server = net.createServer((socket: net.Socket) => {
let buffer: Buffer = Buffer.alloc(0); // Buffer to accumulate received data
socket.on('data', (data: Buffer) => {
traceVerbose('data received from python server: ', data.toString());
buffer = Buffer.concat([buffer, data]); // get the new data and add it to the buffer
while (buffer.length > 0) {
try {
Expand Down Expand Up @@ -92,6 +93,10 @@ export class PythonTestServer implements ITestServer, Disposable {
// if a full json was found in the buffer, fire the data received event then keep cycling with the remaining raw data.
traceVerbose(`Firing data received event, ${extractedJsonPayload.cleanedJsonData}`);
this._fireDataReceived(extractedJsonPayload.uuid, extractedJsonPayload.cleanedJsonData);
} else {
traceVerbose(
`extract json payload incomplete, uuid= ${extractedJsonPayload.uuid} and cleanedJsonData= ${extractedJsonPayload.cleanedJsonData}`,
);
}
buffer = Buffer.from(extractedJsonPayload.remainingRawData);
if (buffer.length === 0) {
Expand Down
Loading