diff --git a/scalib/main.go b/scalib/main.go index e0fba80..dd851a6 100644 --- a/scalib/main.go +++ b/scalib/main.go @@ -52,13 +52,11 @@ func main() { } defer client.rpcClient.Close() // 调用 transferFile - // err = transferFile(client, *curPath, *uploadPath) - // if err != nil { - // logger.Error("TransferFile failed", zap.Error(err)) - // fmt.Printf("TransferFile failed: %v\n", err) - // } + err = transferFile(client, *curPath, *uploadPath) + if err != nil { + logger.Error("TransferFile failed", zap.Error(err)) + } // fmt.Printf("TransferFile success\n") - transferFile(client, *curPath, *uploadPath) } // 创建新的客户端 @@ -83,27 +81,17 @@ func transferFile(c *UpFileClient, curPath string, uploadPath string) error { return err } - // 提取文件名 - // 远程的文件名 - // fileName := filepath.Base(uploadPath) - // fmt.Printf("fileName: %s\n", fileName) - - // 远程服务器的路径 - // dirpath := filepath.Dir(uploadPath) - // fmt.Printf("remote dirpath: %s\n", dirpath) - // fmt.Printf("file size: %d\n", fileInfo.Size()) - // 异步 - // go func() { - // 发送文件信息 - var reply string - c.rpcClient.Call("UpFileService.SendFileInfo", FileInfo{ - FileName: uploadPath, - FileSize: fileInfo.Size(), - }, &reply) - // 输出执行的结果 - fmt.Printf("SendFileInfo result: %v\n", reply) - // }() + go func() { + // 发送文件信息 + var reply string + c.rpcClient.Call("UpFileService.SendFileInfo", FileInfo{ + FileName: uploadPath, + FileSize: fileInfo.Size(), + }, &reply) + // 输出执行的结果 + fmt.Printf("SendFileInfo result: %v\n", reply) + }() return nil }