1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-05 19:43:50 +08:00

Merge pull request #100 from wdvxdr1123/master

fix err shadow
This commit is contained in:
Mrs4s 2021-01-09 21:41:27 +08:00 committed by GitHub
commit 613c4de86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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 {

View File

@ -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