From 1a6b40dc014b48e28f8b95e4469d1d3fc3835e58 Mon Sep 17 00:00:00 2001 From: xc Date: Sun, 28 Sep 2025 10:53:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E6=AD=A5=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/core/FileRpc.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scagent/core/FileRpc.go b/scagent/core/FileRpc.go index dc33dfd..b79f7b4 100644 --- a/scagent/core/FileRpc.go +++ b/scagent/core/FileRpc.go @@ -70,7 +70,11 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error { // 合并为实际路径 remotePath := path.Join("/www/wwwroot", args.RemotePath, zpFileName) // 异步发送文件到远程服务器上 - go clientUploadFile(args.RemoteAddr, ziprl, remotePath) + + go func() { + clientUploadFile(args.RemoteAddr, ziprl, remotePath) + taskId <- "upok" + }() // 返回压缩包名称 *reply = ziprl @@ -103,7 +107,6 @@ func clientUploadFile(remote string, filePath string, uploadPath string) { if err != nil { logger.Error("TransferFile failed", zap.Error(err)) fmt.Printf("TransferFile failed: %v\n", err) - return } fmt.Printf("TransferFile success\n") @@ -111,8 +114,9 @@ func clientUploadFile(remote string, filePath string, uploadPath string) { // 传输文件 func (c *UpFileClient) TransferFile(filePath string, uploadPath string) error { - fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", filePath, uploadPath) + // 发送文件信息 + fmt.Printf("TransferFile filePath: %s, uploadPath: %s\n", filePath, uploadPath) // 获取文件信息 fileInfo, err := os.Stat(filePath) if err != nil {