Downloading chunks now does not copy the chunks, but writes them straight to disk. (Still reads into a buffer first though, but does not allocate on every chunk)
This commit is contained in:
parent
fab43a8d23
commit
14b62b45c5
7 changed files with 96 additions and 109 deletions
|
|
@ -340,12 +340,15 @@ impl<'a> FileOps<'a> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
pub fn write_chunk(
|
||||
pub fn write_chunk<ByteBuf>(
|
||||
&self,
|
||||
who_sent: PeerHandle,
|
||||
data: &Piece<ByteString>,
|
||||
data: &Piece<ByteBuf>,
|
||||
chunk_info: &ChunkInfo,
|
||||
) -> anyhow::Result<()> {
|
||||
) -> anyhow::Result<()>
|
||||
where
|
||||
ByteBuf: AsRef<[u8]>,
|
||||
{
|
||||
let mut buf = data.block.as_ref();
|
||||
let mut absolute_offset = self.lengths.chunk_absolute_offset(&chunk_info);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue