mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
remove created zip directory after finish
This commit is contained in:
parent
3984aaeee2
commit
d50c8f271f
1 changed files with 10 additions and 2 deletions
|
@ -150,8 +150,11 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
|
||||||
if fstats.IsDir {
|
if fstats.IsDir {
|
||||||
// zip the directory
|
// zip the directory
|
||||||
fstats.SentName, err = zipper.ZipFile(fname, true)
|
fstats.SentName, err = zipper.ZipFile(fname, true)
|
||||||
// remove the file when leaving
|
if err != nil {
|
||||||
defer os.Remove(fstats.SentName)
|
log.Error(err)
|
||||||
|
fileReady <- err
|
||||||
|
return
|
||||||
|
}
|
||||||
fname = fstats.SentName
|
fname = fstats.SentName
|
||||||
|
|
||||||
fstat, err := os.Stat(fname)
|
fstat, err := os.Stat(fname)
|
||||||
|
@ -235,6 +238,10 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
|
||||||
log.Debugf("found blocks: %+v", blocksToSkip)
|
log.Debugf("found blocks: %+v", blocksToSkip)
|
||||||
|
|
||||||
// start streaming encryption/compression
|
// start streaming encryption/compression
|
||||||
|
if fstats.IsDir {
|
||||||
|
// remove file if zipped
|
||||||
|
defer os.Remove(fstats.SentName)
|
||||||
|
}
|
||||||
go func(dataChan chan DataChan) {
|
go func(dataChan chan DataChan) {
|
||||||
var buffer []byte
|
var buffer []byte
|
||||||
if useWebsockets {
|
if useWebsockets {
|
||||||
|
@ -242,6 +249,7 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
|
||||||
} else {
|
} else {
|
||||||
buffer = make([]byte, models.TCP_BUFFER_SIZE/2)
|
buffer = make([]byte, models.TCP_BUFFER_SIZE/2)
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPostition := int64(0)
|
currentPostition := int64(0)
|
||||||
for {
|
for {
|
||||||
bytesread, err := f.Read(buffer)
|
bytesread, err := f.Read(buffer)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue