network chunk v4

This commit is contained in:
andrei-mihnea-cerbu
2024-11-12 23:37:59 +02:00
parent 8584a0683f
commit 65606cdd13
3 changed files with 26 additions and 37 deletions
@@ -11,7 +11,6 @@ export class TcpClientCommunicator extends SocketCommunicatorBase {
private readonly socket: Socket;
private aesKey: Buffer | null;
private aesIv: Buffer | null;
private messageBuffer: string;
private serverPublicKey: string | null;
private isAesKeySetFlag: boolean;
private chunkBuffers: { [messageId: string]: string[] }; // Buffer for reassembling chunks
@@ -21,8 +20,7 @@ export class TcpClientCommunicator extends SocketCommunicatorBase {
this.socket = socket;
this.aesKey = null;
this.aesIv = null;
this.serverPublicKey = null;
this.messageBuffer = ''; // Buffer for message reassembly
this.serverPublicKey = null;c
this.isAesKeySetFlag = false;
this.chunkBuffers = {}; // Initialize chunk buffer for reassembling messages
}
@@ -12,7 +12,6 @@ export class TcpServerCommunicator extends SocketCommunicatorBase {
private publicKey: string | null;
private aesKey: Buffer | null;
private aesIv: Buffer | null;
private messageBuffer: string;
private chunkBuffers: { [messageId: string]: string[] }; // Buffer for reassembling chunks
constructor(socket: Socket, ip: string, port: number, operationHandler: OperationHandler) {
@@ -22,7 +21,6 @@ export class TcpServerCommunicator extends SocketCommunicatorBase {
this.publicKey = null; // Client public key will be set later
this.aesKey = null;
this.aesIv = null;
this.messageBuffer = ''; // Initialize the message buffer
this.chunkBuffers = {}; // Buffer for reassembling incoming messages
this.generateKeyPair(); // Generate RSA key pair for encryption
}