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

use single thread upload group image.

This commit is contained in:
Mrs4s 2021-05-24 20:28:18 +08:00
parent 0d8fb8a8a7
commit f6579d20cd
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
2 changed files with 2 additions and 2 deletions

View File

@ -183,7 +183,7 @@ func (c *QQClient) highwayUploadFileMultiThreadingByBDH(path string, cmdId int32
length, _ := io.Copy(h, file) length, _ := io.Copy(h, file)
fh := h.Sum(nil) fh := h.Sum(nil)
_, _ = file.Seek(0, io.SeekStart) _, _ = file.Seek(0, io.SeekStart)
if stat.Size() < 1024*1024*3 { if stat.Size() < 1024*1024*3 || threadCount < 2 {
return c.highwayUploadByBDH(file, length, cmdId, ticket, fh, ext, false) return c.highwayUploadByBDH(file, length, cmdId, ticket, fh, ext, false)
} }
type BlockMetaData struct { type BlockMetaData struct {

View File

@ -91,7 +91,7 @@ func (c *QQClient) UploadGroupImageByFile(groupCode int64, path string) (*messag
c.srvSsoAddrs = append(c.srvSsoAddrs, fmt.Sprintf("%v:%v", binary.UInt32ToIPV4Address(uint32(addr)), rsp.UploadPort[i])) c.srvSsoAddrs = append(c.srvSsoAddrs, fmt.Sprintf("%v:%v", binary.UInt32ToIPV4Address(uint32(addr)), rsp.UploadPort[i]))
} }
} }
if _, err = c.highwayUploadFileMultiThreadingByBDH(path, 2, 4, rsp.UploadKey, EmptyBytes, false); err == nil { if _, err = c.highwayUploadFileMultiThreadingByBDH(path, 2, 1, rsp.UploadKey, EmptyBytes, false); err == nil {
goto ok goto ok
} }
return nil, errors.Wrap(err, "upload failed") return nil, errors.Wrap(err, "upload failed")