mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
increase buffer
This commit is contained in:
parent
4da9ab8f22
commit
4baab7e523
1 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@ import (
|
||||||
|
|
||||||
var log = logrus.New()
|
var log = logrus.New()
|
||||||
|
|
||||||
const BufferSize = 4096
|
const BufferSize = 4096 * 2
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
log.SetFormatter(&logrus.TextFormatter{ForceColors: true})
|
||||||
|
@ -475,7 +475,7 @@ func (c *Client) updateState() (err error) {
|
||||||
if errStats == nil {
|
if errStats == nil {
|
||||||
if fstats.Size() == c.FilesToTransfer[c.FilesToTransferCurrentNum].Size {
|
if fstats.Size() == c.FilesToTransfer[c.FilesToTransferCurrentNum].Size {
|
||||||
// just request missing chunks
|
// just request missing chunks
|
||||||
c.CurrentFileChunks = MissingChunks(pathToFile, fstats.Size(), 4096)
|
c.CurrentFileChunks = MissingChunks(pathToFile, fstats.Size(), BufferSize)
|
||||||
log.Debugf("found %d missing chunks", len(c.CurrentFileChunks))
|
log.Debugf("found %d missing chunks", len(c.CurrentFileChunks))
|
||||||
overwrite = false
|
overwrite = false
|
||||||
}
|
}
|
||||||
|
@ -564,7 +564,7 @@ func (c *Client) dataChannelReceive() (err error) {
|
||||||
timer := time.Now()
|
timer := time.Now()
|
||||||
var mutex = &sync.Mutex{}
|
var mutex = &sync.Mutex{}
|
||||||
piecesToDo := make(map[int64]bool)
|
piecesToDo := make(map[int64]bool)
|
||||||
for i := int64(0); i < c.FilesToTransfer[c.FilesToTransferCurrentNum].Size; i += 4096 {
|
for i := int64(0); i < c.FilesToTransfer[c.FilesToTransferCurrentNum].Size; i += BufferSize {
|
||||||
piecesToDo[i] = true
|
piecesToDo[i] = true
|
||||||
}
|
}
|
||||||
// Register message handling
|
// Register message handling
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue