X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Ftx.go;h=4edbea4e849eb183002f9f77e8d2f2c5ab626f98;hb=cf9363f956cb2d93a581c11ed65c5b02910d10d5;hp=e38084e1a7a3c01390987af3da42c8667d2ee4ab;hpb=9eee562a50358d2f52449e80c8c47116d34f9415;p=nncp.git diff --git a/src/tx.go b/src/tx.go index e38084e..4edbea4 100644 --- a/src/tx.go +++ b/src/tx.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2022 Sergey Matveev +Copyright (C) 2016-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -388,7 +388,9 @@ func prepareTxFile(srcPath string) ( fd.Close() return w.CloseWithError(err) } - if _, err = io.Copy(tarWr, bufio.NewReader(fd)); err != nil { + if _, err = io.Copy( + tarWr, bufio.NewReaderSize(fd, MTHBlockSize), + ); err != nil { fd.Close() return w.CloseWithError(err) } @@ -441,7 +443,7 @@ func (ctx *Ctx) TxFile( _, finalSize, pktName, err := ctx.Tx( node, pkt, nice, srcSize, minSize, maxSize, - bufio.NewReader(reader), dstPath, areaId, + bufio.NewReaderSize(reader, MTHBlockSize), dstPath, areaId, ) les := LEs{ {"Type", "file"}, @@ -469,7 +471,7 @@ func (ctx *Ctx) TxFile( return err } - br := bufio.NewReader(reader) + br := bufio.NewReaderSize(reader, MTHBlockSize) var sizeFull int64 var chunkNum int checksums := [][MTHSize]byte{}