mirror of https://github.com/schollz/croc.git
wait longer on an abnormal finish
This commit is contained in:
parent
d906630f3a
commit
c01bc56079
|
@ -8,8 +8,10 @@ import (
|
|||
|
||||
func (c *Croc) cleanup() {
|
||||
c.cleanupTime = true
|
||||
time.Sleep(250 * time.Millisecond) // race condition, wait for
|
||||
// sending/receiving to finish
|
||||
if !c.normalFinish {
|
||||
time.Sleep(1000 * time.Millisecond) // race condition, wait for
|
||||
// sending/receiving to finish
|
||||
}
|
||||
// erase all the croc files and their possible numbers
|
||||
for i := 0; i < 16; i++ {
|
||||
fname := c.crocFile + "." + strconv.Itoa(i)
|
||||
|
|
|
@ -503,6 +503,7 @@ func (c *Croc) dialUp() (err error) {
|
|||
c.cs.channel.transferTime = time.Since(c.cs.channel.startTransfer)
|
||||
c.cs.Unlock()
|
||||
log.Debug("leaving dialup")
|
||||
c.normalFinish = true
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ type Croc struct {
|
|||
// bothConnected
|
||||
bothConnected bool
|
||||
// cleanupTime tells processes to close up
|
||||
cleanupTime bool
|
||||
cleanupTime bool
|
||||
normalFinish bool
|
||||
}
|
||||
|
||||
// Init will initialize the croc relay
|
||||
|
|
|
@ -32,6 +32,7 @@ func catFiles(files []string, outfile string, remove bool) error {
|
|||
}
|
||||
_, err = io.Copy(finished, fh)
|
||||
if err != nil {
|
||||
fh.Close()
|
||||
return errors.Wrap(err, "CatFiles copy: ")
|
||||
}
|
||||
fh.Close()
|
||||
|
|
Loading…
Reference in New Issue