This commit is contained in:
Baobhan Sith
2025-05-10 01:23:47 +08:00
parent c36e961426
commit 61e7b64333
13 changed files with 653 additions and 276 deletions
+5 -1
View File
@@ -6,6 +6,7 @@ import { initializeUpgradeHandler } from './websocket/upgrade';
import { initializeConnectionHandler } from './websocket/connection';
import { clientStates } from './websocket/state';
import { sshSuspendService } from './services/ssh-suspend.service'; // 导入实例
import { SftpService } from './services/sftp.service'; // +++ 导入 SftpService +++
// TemporaryLogStorageService 是 SshSuspendService 的依赖,SshSuspendService 内部会处理它的实例化或导入,
// websocket.ts 层面不需要直接使用 temporaryLogStorageService。
// 如果 SshSuspendService 的构造函数需要一个 TemporaryLogStorageService 实例,
@@ -43,8 +44,11 @@ export const initializeWebSocket = async (server: http.Server, sessionParser: Re
// 2. Initialize Upgrade Handler (handles authentication and protocol upgrade)
initializeUpgradeHandler(server, wss, sessionParser);
// +++ 创建 SftpService 实例 +++
const sftpService = new SftpService(clientStates);
// 3. Initialize Connection Handler (handles 'connection' event and message routing)
initializeConnectionHandler(wss, sshSuspendService); // 传递 sshSuspendService 实例
initializeConnectionHandler(wss, sshSuspendService, sftpService); // +++ 传递 sftpService 实例 +++
// --- WebSocket 服务器关闭处理 ---
wss.on('close', () => {