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 {