done
This commit is contained in:
@@ -9,7 +9,7 @@ import { UserInfoScheme } from '../database/schemes/app_config_scheme'
|
||||
|
||||
export class BackupRetrievalWorker {
|
||||
private db: Database
|
||||
private readonly clientPort: number
|
||||
private readonly port: number
|
||||
private readonly destinationPath: string
|
||||
private encryptionKey: Buffer | null = null
|
||||
private iv: Buffer | null = null
|
||||
@@ -19,7 +19,7 @@ export class BackupRetrievalWorker {
|
||||
|
||||
constructor(pathToDatabaseFile: string, clientPort: number, destinationPath: string) {
|
||||
this.db = new Database(pathToDatabaseFile)
|
||||
this.clientPort = clientPort
|
||||
this.port = clientPort
|
||||
this.destinationPath = destinationPath
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class BackupRetrievalWorker {
|
||||
}
|
||||
|
||||
private async processBackupForIp(ip: string, userInfo: UserInfoScheme): Promise<boolean> {
|
||||
this.tcpCommunicator = new TcpCommunicator(ip, this.clientPort)
|
||||
this.tcpCommunicator = new TcpCommunicator(ip, this.port)
|
||||
if (!(await this.tcpCommunicator.connect())) {
|
||||
this.log(`Failed to connect to ${ip}`, 'error')
|
||||
return true
|
||||
|
||||
@@ -4,12 +4,7 @@ import { TcpCommunicator } from './tcp_communicator'
|
||||
import { operationCodes } from '../network/operation_codes'
|
||||
import { ParsedMessage } from '../network/message_handler'
|
||||
import { Database } from '../database/database'
|
||||
|
||||
interface FileSendTask {
|
||||
ip: string
|
||||
path: string
|
||||
userName: string
|
||||
}
|
||||
import {FileItemTask} from "../database/schemes/local_resources_scheme";
|
||||
|
||||
export class FileSharer {
|
||||
private readonly db: Database
|
||||
@@ -65,7 +60,7 @@ export class FileSharer {
|
||||
}
|
||||
|
||||
// Method to send the file to a specific IP using TcpCommunicator
|
||||
private async sendFile(task: FileSendTask): Promise<boolean> {
|
||||
private async sendFile(task: FileItemTask): Promise<boolean> {
|
||||
const { ip, path: filePath, userName } = task
|
||||
|
||||
// Ensure the file exists before attempting to send
|
||||
|
||||
Reference in New Issue
Block a user