Browse Source

调整远程文件

master
xyiege 6 months ago
parent
commit
0d7e98c950
  1. 9
      scagent/core/FileRpc.go

9
scagent/core/FileRpc.go

@ -114,10 +114,9 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error {
// 如果压缩包生成成功以后再执行 // 如果压缩包生成成功以后再执行
if strings.EqualFold(strings.ToLower(rest), "arcok") { if strings.EqualFold(strings.ToLower(rest), "arcok") {
// 合并为实际路径 // 合并为实际路径
// remotePath := path.Join("/www/wwwroot", args.RemotePath, zpFileName) remotePath := path.Join("/www/wwwroot", args.RemotePath, zpFileName)
// 异步发送文件到远程服务器上 // 异步发送文件到远程服务器上
// go clientUploadFile(args.RemoteAddr, ziprl, remotePath) go clientUploadFile(args.RemoteAddr, ziprl, remotePath)
go clientUploadFile(args.RemoteAddr, ziprl)
// 返回压缩包名称 // 返回压缩包名称
*reply = ziprl *reply = ziprl
@ -128,7 +127,7 @@ func (f *FileService) Compress(args *ZipBlock, reply *string) error {
// 客户端调用RPC传送文件的函数 // 客户端调用RPC传送文件的函数
// 传入zip的实际路径,远程的服务器带端口,远程文件存放路径 // 传入zip的实际路径,远程的服务器带端口,远程文件存放路径
func clientUploadFile(remote string, filePath string) error { func clientUploadFile(remote string, filePath string, uploadPath string) error {
// fmt.Printf("remote: %s, filePath: %s, uploadPath: %s\n", remote, filePath, uploadPath) // fmt.Printf("remote: %s, filePath: %s, uploadPath: %s\n", remote, filePath, uploadPath)
// 启用日志 // 启用日志
logger := util.NewProductionLogger() logger := util.NewProductionLogger()
@ -190,7 +189,7 @@ func clientUploadFile(remote string, filePath string) error {
// 发送文件块 // 发送文件块
err = client.Call("FileService.SendFileChunk", FileChunk{ err = client.Call("FileService.SendFileChunk", FileChunk{
Data: buffer[:n], Data: buffer[:n],
FileName: fileName, FileName: uploadPath,
Offset: offset, Offset: offset,
IsLast: isLast, IsLast: isLast,
}, &reply) }, &reply)

Loading…
Cancel
Save