Skip to content

Commit

Permalink
FIX: el rpc request
Browse files Browse the repository at this point in the history
  • Loading branch information
gbayasgalan committed Dec 6, 2024
1 parent 6848fcc commit 1fec062
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions launcher/src/backend/SSHService.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,34 @@ export class SSHService {
log.error("Forwarding error: ", err);
return;
}
// Track data size for el rpc
connection.on("data", (data) => {
stream.write(data);
this.handleReceivedData(data.length, forwardOptions.srcPort);
});

// Pipe the connection to the stream and vice versa
connection.pipe(stream).pipe(connection);
connection.on("end", () => {
stream.end();
});
stream.on("end", () => {
connection.end();
});

// Listen for data on the stream
stream.on("data", (data) => {
// Call the handleReceivedData method to handle the received data
this.handleReceivedData(data.length, forwardOptions.srcPort);
connection.on("error", (error) => {
log.error("Connection error: ", error);
stream.end();
});

stream.on("error", (error) => {
log.error("Stream error: ", error);
connection.end();
});

connection.on("close", () => {
stream.destroy();
});
stream.on("close", () => {
connection.destroy();
});
}
);
Expand Down

0 comments on commit 1fec062

Please sign in to comment.