diff --git a/client/highway.go b/client/highway.go index 949fc5fc..c755b8d6 100644 --- a/client/highway.go +++ b/client/highway.go @@ -243,7 +243,6 @@ func (c *QQClient) highwayUploadFileMultiThreadingByBDH(path string, cmdId int32 }) } doUpload := func() error { - defer cond.Signal() // 成功和失败都得提醒一次 conn, err := net.DialTimeout("tcp", c.srvSsoAddrs[0], time.Second*20) if err != nil { return errors.Wrap(err, "connect error") @@ -339,13 +338,14 @@ func (c *QQClient) highwayUploadFileMultiThreadingByBDH(path string, cmdId int32 for i := 0; i < threadCount; i++ { go func() { defer wg.Done() + defer cond.Signal() if err := doUpload(); err != nil { lastErr = err } }() } wg.Wait() - return rspExt, err + return rspExt, lastErr } func (c *QQClient) highwaySendHeartbreak(conn net.Conn) error { diff --git a/client/ptt.go b/client/ptt.go index 786c4cee..bfbd46f2 100644 --- a/client/ptt.go +++ b/client/ptt.go @@ -115,7 +115,8 @@ func (c *QQClient) UploadGroupShortVideo(groupCode int64, video, thumb io.ReadSe ext, _ := proto.Marshal(c.buildPttGroupShortVideoProto(videoHash, thumbHash, groupCode, videoLen, thumbLen).PttShortVideoUploadReq) var hwRsp []byte if cache != "" { - file, err := os.OpenFile(cache, os.O_WRONLY|os.O_CREATE, 0666) + var file *os.File + file, err = os.OpenFile(cache, os.O_WRONLY|os.O_CREATE, 0666) cp := func() error { _, err := io.Copy(file, utils.MultiReadSeeker(thumb, video)) return err