From c6425150072fd1010b6d2798bdcc4be8303e394e Mon Sep 17 00:00:00 2001 From: whr819987540 <819987540@qq.com> Date: Mon, 8 May 2023 16:38:45 +0800 Subject: [PATCH] use mbpp to modify mbp --- storage/memory.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/storage/memory.go b/storage/memory.go index 1015dbe2..a90fa23c 100644 --- a/storage/memory.go +++ b/storage/memory.go @@ -142,7 +142,9 @@ func (mci MemoryClientImpl) OpenTorrent(info *metainfo.Info, infoHash metainfo.H // NewMemory acts differently for seeders and leechers // for seeders, mbpp not nill, mbp not nill, mb not nil -// for leechers, mbpp not nill, mbp nill, mb nill. we can access the downloaded date through the returned mbpp +// for leechers, mbpp not nill, mbp nill, mb nill. +// this function make mbp not nill, mb not nill. +// we can access the downloaded date through the returned mbpp func NewMemory(totalLength int64, mbpp **MemoryBuf) (ClientImplCloser, error) { return NewMemoryWithCompletion(totalLength, mbpp) } @@ -179,11 +181,10 @@ func NewMemoryWithCompletion(totalLength int64, mbpp **MemoryBuf) (ClientImplClo }, PieceCompletion: pieceCompletionForDir("./"), // 默认选择sqlite, sqlite的db文件放在./下面 } - mbp := &MemoryBuf{ + *mbpp = &MemoryBuf{ Data: data, Length: totalLength, } - mbpp = &mbp } return MemoryClientImpl{opts}, nil