Skip to content

Commit 1fec062

Browse files
committed
FIX: el rpc request
1 parent 6848fcc commit 1fec062

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

launcher/src/backend/SSHService.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,34 @@ export class SSHService {
310310
log.error("Forwarding error: ", err);
311311
return;
312312
}
313+
// Track data size for el rpc
314+
connection.on("data", (data) => {
315+
stream.write(data);
316+
this.handleReceivedData(data.length, forwardOptions.srcPort);
317+
});
313318

314-
// Pipe the connection to the stream and vice versa
315-
connection.pipe(stream).pipe(connection);
319+
connection.on("end", () => {
320+
stream.end();
321+
});
322+
stream.on("end", () => {
323+
connection.end();
324+
});
316325

317-
// Listen for data on the stream
318-
stream.on("data", (data) => {
319-
// Call the handleReceivedData method to handle the received data
320-
this.handleReceivedData(data.length, forwardOptions.srcPort);
326+
connection.on("error", (error) => {
327+
log.error("Connection error: ", error);
328+
stream.end();
329+
});
330+
331+
stream.on("error", (error) => {
332+
log.error("Stream error: ", error);
333+
connection.end();
334+
});
335+
336+
connection.on("close", () => {
337+
stream.destroy();
338+
});
339+
stream.on("close", () => {
340+
connection.destroy();
321341
});
322342
}
323343
);

0 commit comments

Comments
 (0)