From 1efa4be23d692cf9720d5e3dc180b21a6f4be744 Mon Sep 17 00:00:00 2001 From: Sydonian <794346190@qq.com> Date: Fri, 21 Jul 2023 14:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=90=84=E7=A7=8DID=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=94=B9=E6=88=90int64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/config/config.go | 2 +- internal/services/grpc/grpc_service.go | 2 -- status_report.go | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 5d2bd17..50888d6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,7 +8,7 @@ import ( ) type Config struct { - ID int `json:"id"` + ID int64 `json:"id"` GRPCListenAddress string `json:"grpcListenAddress"` LocalIP string `json:"localIP"` StorageBaseDir string `json:"storageBaseDir"` diff --git a/internal/services/grpc/grpc_service.go b/internal/services/grpc/grpc_service.go index ff6c770..d3b5100 100644 --- a/internal/services/grpc/grpc_service.go +++ b/internal/services/grpc/grpc_service.go @@ -39,7 +39,6 @@ func (s *GRPCService) SendFile(server agentserver.FileTransport_SendFileServer) // 即使err是io.EOF,只要没有收到客户端包含EOF数据包就被断开了连接,就认为接收失败 if err != nil { // 关闭文件写入,不需要返回的hash和error - // TODO 需要研究一下通过错误中断写入后,已发送的文件数据能不能自动删除 writer.Abort(io.ErrClosedPipe) log.WithField("ReceiveSize", recvSize). Warnf("recv message failed, err: %s", err.Error()) @@ -70,7 +69,6 @@ func (s *GRPCService) SendFile(server agentserver.FileTransport_SendFileServer) FileHash: hash, }) if err != nil { - // TODO 文件已经完整写入,需要考虑是否删除此文件 log.Warnf("send response failed, err: %s", err.Error()) return fmt.Errorf("send response failed, err: %w", err) } diff --git a/status_report.go b/status_report.go index e360514..66c0b41 100644 --- a/status_report.go +++ b/status_report.go @@ -56,7 +56,7 @@ func reportStatus(wg *sync.WaitGroup) { //发送心跳 // TODO 由于数据结构未定,暂时不发送真实数据 - coorCli.AgentStatusReport(coormsg.NewAgentStatusReportBody(config.Cfg().ID, []int{}, []int{}, ipfsStatus, localDirStatus)) + coorCli.AgentStatusReport(coormsg.NewAgentStatusReportBody(config.Cfg().ID, []int64{}, []int{}, ipfsStatus, localDirStatus)) time.Sleep(time.Minute * 5) }