mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
Broken
This commit is contained in:
parent
3bb5f43c07
commit
23e19b009c
1 changed files with 8 additions and 1 deletions
|
@ -387,6 +387,10 @@ func (c *Connection) receiveFile(id int, connection net.Conn) error {
|
||||||
fileSizeInt, _ := strconv.Atoi(fileDataString)
|
fileSizeInt, _ := strconv.Atoi(fileDataString)
|
||||||
chunkSize := int64(fileSizeInt)
|
chunkSize := int64(fileSizeInt)
|
||||||
logger.Debugf("chunk size: %d", chunkSize)
|
logger.Debugf("chunk size: %d", chunkSize)
|
||||||
|
if chunkSize == 0 {
|
||||||
|
logger.Debug(fileSizeBuffer)
|
||||||
|
return errors.New("chunk size is empty!")
|
||||||
|
}
|
||||||
|
|
||||||
os.Remove(c.File.Name + ".enc." + strconv.Itoa(id))
|
os.Remove(c.File.Name + ".enc." + strconv.Itoa(id))
|
||||||
log.Debug("Making " + c.File.Name + ".enc." + strconv.Itoa(id))
|
log.Debug("Making " + c.File.Name + ".enc." + strconv.Itoa(id))
|
||||||
|
@ -448,7 +452,10 @@ func (c *Connection) sendFile(id int, connection net.Conn) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
logger.Debugf("sending chunk size: %d", fi.Size())
|
logger.Debugf("sending chunk size: %d", fi.Size())
|
||||||
connection.Write([]byte(fillString(strconv.FormatInt(int64(fi.Size()), 10), 10)))
|
_, err = connection.Write([]byte(fillString(strconv.FormatInt(int64(fi.Size()), 10), 10)))
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "Problem sending chunk data: ")
|
||||||
|
}
|
||||||
|
|
||||||
// show the progress
|
// show the progress
|
||||||
if !c.Debug {
|
if !c.Debug {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue